From 608b1332bede8c9603db08f3084da5e6e7469605 Mon Sep 17 00:00:00 2001 From: Bryan Smith Date: Wed, 1 Jun 2016 08:08:22 -0700 Subject: [PATCH] fix(http-client): silence bluebird warning (#62) --- src/http-client.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/http-client.js b/src/http-client.js index 858e190..bbc6f29 100644 --- a/src/http-client.js +++ b/src/http-client.js @@ -208,7 +208,15 @@ function applyInterceptors(input, interceptors, successName, errorName, ...inter let errorHandler = interceptor[errorName]; return chain.then( - successHandler && (value => interceptor::successHandler(value, ...interceptorArgs)), - errorHandler && (reason => interceptor::errorHandler(reason, ...interceptorArgs))); + successHandler && (value => interceptor::successHandler(value, ...interceptorArgs)) || identity, + errorHandler && (reason => interceptor::errorHandler(reason, ...interceptorArgs)) || thrower); }, Promise.resolve(input)); } + +function identity(x) { + return x; +} + +function thrower(x) { + throw x; +}