diff --git a/lib/client.js b/lib/client.js index 57e770b..f446b4c 100644 --- a/lib/client.js +++ b/lib/client.js @@ -157,9 +157,14 @@ Client.prototype = { }); - /* Custom error handler */ + // Try the local error handler + if (options.errorHandler) { + promise = promise.catch(options.errorHandler); + } + + // Fallback to the global error handler if (this.errorHandler) { - return promise.catch(this.errorHandler); + promise = promise.catch(this.errorHandler); } return promise;