Use DOCKER_ERROR for docker errors

This commit is contained in:
Girish Ramakrishnan
2019-09-23 23:27:32 -07:00
parent 4b6ac538ac
commit 29ce80cebe
2 changed files with 19 additions and 18 deletions

View File

@@ -18,16 +18,17 @@ function BoxError(reason, errorOrMessage, details) {
this.name = this.constructor.name;
this.reason = reason;
this.details = details || {};
if (typeof errorOrMessage === 'undefined') {
this.message = reason;
} else if (typeof errorOrMessage === 'string') {
this.message = errorOrMessage;
} else {
this.message = 'Internal error';
} else { // error object
this.message = errorOrMessage.message;
this.nestedError = errorOrMessage;
_.extend(this.details, errorOrMessage); // copy enumerable properies
}
this.details = details || {};
}
util.inherits(BoxError, Error);
BoxError.ACCESS_DENIED = 'Access Denied';