@ocap/util
Version:
utils shared across multiple forge js libs, works in both node.js and browser
23 lines (22 loc) • 711 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PersistError = exports.CustomError = void 0;
/* eslint-disable max-classes-per-file */
class CustomError extends Error {
constructor(code, message, props = {}) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CustomError);
}
this.code = code;
this.props = { persist: false, ...props };
}
}
exports.CustomError = CustomError;
class PersistError extends CustomError {
constructor(code, message, props = {}) {
super(code, message);
this.props = { persist: true, ...props };
}
}
exports.PersistError = PersistError;