Add in reason if available, to error message

This commit is contained in:
Bryan Ashby 2018-01-20 15:16:10 -07:00
parent 16c8fd0afc
commit b1cea5edd7
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,10 @@ class EnigError extends Error {
this.reason = reason;
this.reasonCode = reasonCode;
if(this.reason) {
this.message += `: ${this.reason}`;
}
if(typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
} else {