@tsdotnet/exceptions
Version:
[](https://github.com/tsdotnet/exceptions/blob/master/LICENSE)  [ {
var _a;
this.message = message;
this.innerException = innerException;
this.name = this.getName();
// Node has a .stack, let's use it...
try {
// To avoid unnecessary imports, use eval.
// tslint:disable-next-line:no-eval
const stack = ((_a = eval('new Error()')
.stack) === null || _a === void 0 ? void 0 : _a.replace(/^Error\n/, '').replace(/(.|\n)+\s+at new.+/, '')) || '';
this.stack = this.toStringWithoutBrackets() + stack;
}
catch (ex) {
this.stack = '';
}
}
/**
* The string representation of the Exception instance.
*/
toString() {
return `[${this.toStringWithoutBrackets()}]`;
}
/**
* A string representation of the error type.
*/
getName() {
return NAME;
}
toStringWithoutBrackets() {
const m = this.message;
return this.name + (m ? ': ' + m : '');
}
}
//# sourceMappingURL=Exception.js.map