UNPKG

@metamask/kernel-errors

Version:
39 lines 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VatAlreadyExistsError = void 0; const superstruct_1 = require("@metamask/superstruct"); const BaseError_ts_1 = require("../BaseError.cjs"); const constants_ts_1 = require("../constants.cjs"); class VatAlreadyExistsError extends BaseError_ts_1.BaseError { constructor(vatId, options) { super(constants_ts_1.ErrorCode.VatAlreadyExists, 'Vat already exists.', { ...options, data: { vatId }, }); harden(this); } /** * Unmarshals a {@link MarshaledError} into a {@link VatAlreadyExistsError}. * * @param marshaledError - The marshaled error to unmarshal. * @param unmarshalErrorOptions - The function to unmarshal the error options. * @returns The unmarshaled error. */ static unmarshal(marshaledError, unmarshalErrorOptions) { (0, superstruct_1.assert)(marshaledError, this.struct); return new VatAlreadyExistsError(marshaledError.data.vatId, unmarshalErrorOptions(marshaledError)); } } exports.VatAlreadyExistsError = VatAlreadyExistsError; /** * A superstruct struct for validating marshaled {@link VatAlreadyExistsError} instances. */ VatAlreadyExistsError.struct = (0, superstruct_1.object)({ ...constants_ts_1.marshaledErrorSchema, code: (0, superstruct_1.literal)(constants_ts_1.ErrorCode.VatAlreadyExists), data: (0, superstruct_1.object)({ vatId: (0, superstruct_1.string)(), }), }); harden(VatAlreadyExistsError); //# sourceMappingURL=VatAlreadyExistsError.cjs.map