You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/06/16 13:27:45 UTC
[incubator-openwhisk-client-js] branch master updated: pass through
statusCode on errors (#54)
This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-js.git
The following commit(s) were added to refs/heads/master by this push:
new 3793c44 pass through statusCode on errors (#54)
3793c44 is described below
commit 3793c44f93d2eeb24380909c65bcf224ccf95699
Author: Nick Mitchell <st...@users.noreply.github.com>
AuthorDate: Fri Jun 16 09:27:43 2017 -0400
pass through statusCode on errors (#54)
---
lib/client.js | 2 +-
lib/openwhisk_error.js | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/client.js b/lib/client.js
index 45bef0c..b6666e8 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -92,7 +92,7 @@ class Client {
message = `${reason.options.method} ${reason.options.url} Returned HTTP ${reason.statusCode} (${http.STATUS_CODES[reason.statusCode]}) --> "${responseError}"`
}
- throw new OpenWhiskError(message, reason.error)
+ throw new OpenWhiskError(message, reason.error, reason.statusCode)
}
// Error messages might be returned from platform or using custom
diff --git a/lib/openwhisk_error.js b/lib/openwhisk_error.js
index 73b26bc..eb64e17 100644
--- a/lib/openwhisk_error.js
+++ b/lib/openwhisk_error.js
@@ -3,11 +3,12 @@
'use strict';
-module.exports = function OpenWhiskError(message, error) {
+module.exports = function OpenWhiskError(message, error, statusCode) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.error = error;
+ this.statusCode = statusCode;
};
require('util').inherits(module.exports, Error);
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].