Well, if you're the pouchdb-security user, which message do you think more clearly describes what's going on when you're calling installSecurityMethods() twice?
- Security methods already installed
- Wrapper method for .get() already installed: function () {/* body of handler - i.e. some security logic here */}
The second requires inside knowledge of pouchdb-wrappers/pouchdb-security, which is why I change the error message. The second one is great for debugging pouchdb-wrappers, but not so much as a high-level error when you don't actually need to know pouchdb-wrappers is used internally.
As for speed: You'd need a situation where you need to wrap dbs a lot of times. I think you'd quickly start caching db objects - like express-pouchdb does. Once wrapped, it's not necessary to call it again. Since I don't see this end up in a hot code path anytime soon, I prefer the clearer error message.
Well, if you're the pouchdb-security user, which message do you think more clearly describes what's going on when you're calling installSecurity Methods( ) twice?
- Security methods already installed
- Wrapper method for .get() already installed: function () {/* body of handler - i.e. some security logic here */}
The second requires inside knowledge of pouchdb- wrappers/ pouchdb- security, which is why I change the error message. The second one is great for debugging pouchdb-wrappers, but not so much as a high-level error when you don't actually need to know pouchdb-wrappers is used internally.
As for speed: You'd need a situation where you need to wrap dbs a lot of times. I think you'd quickly start caching db objects - like express-pouchdb does. Once wrapped, it's not necessary to call it again. Since I don't see this end up in a hot code path anytime soon, I prefer the clearer error message.