Conversation
|
It looks like this adds an option to the method that cancels an existing option that came from the constructor. I think that overriding the error handler would be a better fit, or even just having your code use two clients, one with an error handler and one without. |
|
@trevorah We would need two clients and this is the route we opted for in our skype (@suprememoocow and I) |
lib/client.js
Outdated
|
|
||
| /* Custom error handler */ | ||
| if (this.errorHandler) { | ||
| if (!options.disableErrorHandler && this.errorHandler) { |
There was a problem hiding this comment.
This works, but a more flexible approach might be to allow the caller to intercept the error before the global error handler kicks in.
So, something like:
// Install local error handler
if (options.errorHandler) {
promise = promise.catch(options.errorHandler);
}
// Install global error handler
if (this.errorHandler) {
promise = promise.catch(this.errorHandler);
}
return promise;This way, you get given the option to swallow the error locally before the global error handler gets called. So, this gives you flexibility to ignore the error, conditionally ignore certain errors or throw a different type of error.
627cd11 to
91a27c7
Compare
Add
disableErrorHandlererrorHandleroptionUsed in https://github.com/troupe/gitter-webapp/pull/2485
Todo