Enigma error objects
This commit is contained in:
19
core/enig_error.js
Normal file
19
core/enig_error.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
class EnigError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
|
||||
this.name = this.constructor.name;
|
||||
this.message = message;
|
||||
|
||||
if(typeof Error.captureStackTrace === 'function') {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
this.stack = (new Error(message)).stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.EnigError = EnigError;
|
||||
Reference in New Issue
Block a user