UNPKG

@metamask/kernel-errors

Version:
30 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseError = void 0; const constants_ts_1 = require("./constants.cjs"); class BaseError extends Error { constructor(code, message, options = {}) { const { data, cause, stack } = options; super(message, { cause }); this.name = this.constructor.name; this.code = code; this.data = data; // override the stack property if provided if (stack) { this.stack = stack; } harden(this); } /** * A placeholder for unmarshal functionality. Should be implemented in subclasses. * * @param _marshaledError - The marshaled error to unmarshal. * @param _unmarshalErrorOptions - A function to unmarshal the error options. */ static unmarshal(_marshaledError, _unmarshalErrorOptions) { throw new Error('Unmarshal method not implemented'); } } exports.BaseError = BaseError; harden(BaseError); //# sourceMappingURL=BaseError.cjs.map