bugfix: properly stringify message and pass details
This commit is contained in:
parent
5ef53ecb23
commit
2ea44e3a46
|
@ -39,7 +39,7 @@ function create(old, msg, code, status, details) {
|
||||||
function toJSON() {
|
function toJSON() {
|
||||||
/*jshint validthis:true*/
|
/*jshint validthis:true*/
|
||||||
return {
|
return {
|
||||||
message: this.client_message,
|
message: this.message,
|
||||||
status: this.status,
|
status: this.status,
|
||||||
code: this.code,
|
code: this.code,
|
||||||
details: this.details
|
details: this.details
|
||||||
|
@ -72,7 +72,7 @@ module.exports = {
|
||||||
* @returns {AuthError}
|
* @returns {AuthError}
|
||||||
*/
|
*/
|
||||||
DEVELOPER_ERROR: function (old, msg, details) {
|
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) {
|
BAD_GATEWAY: function (err) {
|
||||||
var msg =
|
var msg =
|
||||||
|
@ -84,7 +84,7 @@ module.exports = {
|
||||||
if (err.response && err.response.statusCode) {
|
if (err.response && err.response.statusCode) {
|
||||||
details.push("response.statusCode = " + 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);
|
||||||
},
|
},
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue