@metamask/kernel-errors
Version:
37 lines • 1.37 kB
text/typescript
import type { Struct } from "@metamask/superstruct";
import type { MarshaledError, MarshaledOcapError } from "./types.mjs";
/**
* Struct to validate plain {@link Error} objects.
*/
export declare const ErrorStruct: Struct<Error, null>;
/**
* Enum defining all error codes for Ocap errors.
*/
export declare const ErrorCode: {
readonly StreamReadError: "STREAM_READ_ERROR";
readonly VatAlreadyExists: "VAT_ALREADY_EXISTS";
readonly VatDeleted: "VAT_DELETED";
readonly VatNotFound: "VAT_NOT_FOUND";
readonly SubclusterNotFound: "SUBCLUSTER_NOT_FOUND";
};
export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
/**
* A sentinel value used to identify marshaled errors.
*/
export declare const ErrorSentinel = "@@MARSHALED_ERROR";
export declare const marshaledErrorSchema: {
"@@MARSHALED_ERROR": Struct<true, true>;
message: Struct<string, null>;
code: Struct<ErrorCode | Struct<ErrorCode, unknown> | undefined, null>;
data: Struct<import("@metamask/utils").Json | undefined, unknown>;
stack: Struct<string | undefined, null>;
};
/**
* Struct to validate marshaled errors.
*/
export declare const MarshaledErrorStruct: Struct<MarshaledError>;
/**
* Struct to validate marshaled ocap errors.
*/
export declare const MarshaledOcapErrorStruct: Struct<MarshaledOcapError>;
//# sourceMappingURL=constants.d.mts.map