Send details as part of AppsError

the last mile module has been updated to pipe through additional properties.
This commit is contained in:
Girish Ramakrishnan
2019-09-01 13:42:25 -07:00
parent fc10b4a79b
commit c0a1db6941

View File

@@ -123,9 +123,10 @@ var appdb = require('./appdb.js'),
// http://dustinsenos.com/articles/customErrorsInNode
// http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
function AppsError(reason, errorOrMessage) {
function AppsError(reason, errorOrMessage, details) {
assert.strictEqual(typeof reason, 'string');
assert(errorOrMessage instanceof Error || typeof errorOrMessage === 'string' || typeof errorOrMessage === 'undefined');
assert(typeof details === 'object' || typeof details === 'undefined');
Error.call(this);
Error.captureStackTrace(this, this.constructor);
@@ -140,6 +141,8 @@ function AppsError(reason, errorOrMessage) {
this.message = 'Internal error';
this.nestedError = errorOrMessage;
}
if (details) _.extend(this, details);
}
util.inherits(AppsError, Error);
AppsError.INTERNAL_ERROR = 'Internal Error';