backend-manager 3.2.66 → 3.2.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -355,7 +355,8 @@ BackendAssistant.prototype.errorify = function (e, options) {
|
|
|
355
355
|
options = options || {};
|
|
356
356
|
|
|
357
357
|
// Code: default to 500, or else use the user's option
|
|
358
|
-
|
|
358
|
+
const isCodeSet = typeof options.code !== 'undefined';
|
|
359
|
+
options.code = !isCodeSet
|
|
359
360
|
? 500
|
|
360
361
|
: options.code;
|
|
361
362
|
|
|
@@ -385,7 +386,9 @@ BackendAssistant.prototype.errorify = function (e, options) {
|
|
|
385
386
|
: new Error(stringify(e));
|
|
386
387
|
|
|
387
388
|
// Fix code
|
|
388
|
-
options.code = newError.code || options.code;
|
|
389
|
+
// options.code = newError.code || options.code;
|
|
390
|
+
options.code = isCodeSet ? options.code : newError.code || options.code;
|
|
391
|
+
options.code = parseInt(options.code);
|
|
389
392
|
options.code = isBetween(options.code, 400, 599) ? options.code : 500;
|
|
390
393
|
|
|
391
394
|
// Attach properties
|
|
@@ -453,6 +456,9 @@ BackendAssistant.prototype.respond = function(response, options) {
|
|
|
453
456
|
? true
|
|
454
457
|
: options.log;
|
|
455
458
|
|
|
459
|
+
// Fix code
|
|
460
|
+
options.code = parseInt(options.code);
|
|
461
|
+
|
|
456
462
|
// Handle error
|
|
457
463
|
const isErrorCode = isBetween(options.code, 400, 599);
|
|
458
464
|
if (
|