shallow-render
Version:
Shallow rendering test utility for Angular
30 lines • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomError = void 0;
/*
JavaScript errors are stupid
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types
*/
const ExtendableBuiltIn = (cls) => {
function Extendable() {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line prefer-rest-params
cls.apply(this, arguments);
}
Extendable.prototype = Object.create(cls.prototype);
Object.setPrototypeOf(Extendable, cls);
return Extendable;
};
class CustomError extends ExtendableBuiltIn(Error) {
constructor(message) {
super();
this.message = message;
// Maintains proper stack trace for where our error was thrown (only available on V8)
if ('captureStackTrace' in Error) {
Error.captureStackTrace(this, CustomError);
}
}
}
exports.CustomError = CustomError;
//# sourceMappingURL=custom-error.js.map