From 2ea44e3a4648e629a155bcd8e6d0f4630b9666eb Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 21 Oct 2021 13:37:12 -0600 Subject: [PATCH] bugfix: properly stringify message and pass details --- lib/errors.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/errors.js b/lib/errors.js index 820f5a4..1692844 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -39,7 +39,7 @@ function create(old, msg, code, status, details) { function toJSON() { /*jshint validthis:true*/ return { - message: this.client_message, + message: this.message, status: this.status, code: this.code, details: this.details @@ -72,7 +72,7 @@ module.exports = { * @returns {AuthError} */ DEVELOPER_ERROR: function (old, msg, details) { - return create(old, msg, E_DEVELOPER, 500, details); + return create(old, msg || old, E_DEVELOPER, 500, details); }, BAD_GATEWAY: function (err) { var msg = @@ -84,7 +84,7 @@ module.exports = { if (err.response && err.response.statusCode) { details.push("response.statusCode = " + err.response.statusCode); } - return create(msg, msg, E_BAD_GATEWAY, 502); + return create(msg, msg, E_BAD_GATEWAY, 502, details); }, //