From 5671155d74bf5bfc5b3c52336e2122d4c8926752 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 9 Nov 2016 06:33:00 -0600 Subject: [PATCH 1/2] Add disableErrorHandler option --- lib/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 57e770b..7407217 100644 --- a/lib/client.js +++ b/lib/client.js @@ -158,7 +158,7 @@ Client.prototype = { }); /* Custom error handler */ - if (this.errorHandler) { + if (!options.disableErrorHandler && this.errorHandler) { return promise.catch(this.errorHandler); } From 91a27c7fbcd3f9e6c8817ca95c39580dabf994d2 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 16 Nov 2016 09:38:04 -0600 Subject: [PATCH 2/2] Swallow error by locally passed errorHandler option via @suprememoocow --- lib/client.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/client.js b/lib/client.js index 7407217..f446b4c 100644 --- a/lib/client.js +++ b/lib/client.js @@ -157,9 +157,14 @@ Client.prototype = { }); - /* Custom error handler */ - if (!options.disableErrorHandler && this.errorHandler) { - return promise.catch(this.errorHandler); + // Try the local error handler + if (options.errorHandler) { + promise = promise.catch(options.errorHandler); + } + + // Fallback to the global error handler + if (this.errorHandler) { + promise = promise.catch(this.errorHandler); } return promise;