Add BoxError.toPlainObject
This commit is contained in:
+6
-1
@@ -3,7 +3,8 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert'),
|
||||
util = require('util');
|
||||
util = require('util'),
|
||||
_ = require('underscore');
|
||||
|
||||
exports = module.exports = BoxError;
|
||||
|
||||
@@ -36,3 +37,7 @@ BoxError.CONFLICT = 'Conflict';
|
||||
BoxError.EXTERNAL_ERROR = 'External Error';
|
||||
BoxError.INTERNAL_ERROR = 'Internal Error';
|
||||
BoxError.NOT_FOUND = 'Not found';
|
||||
|
||||
BoxError.prototype.toPlainObject = function () {
|
||||
return _.extend({}, { message: this.message, reason: this.reason }, this.details);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user