UNPKG

@metamask/kernel-errors

Version:
57 lines 2.26 kB
import { BaseError } from "../BaseError.mjs"; import type { ErrorOptionsWithStack, MarshaledOcapError } from "../types.mjs"; type StreamReadErrorData = { vatId: string; } | { kernelId: string; }; type StreamReadErrorOptions = Required<ErrorOptions> & Pick<ErrorOptionsWithStack, 'stack'>; export declare class StreamReadError extends BaseError { constructor(data: StreamReadErrorData, options: StreamReadErrorOptions); /** * A superstruct struct for validating marshaled {@link StreamReadError} instances. */ static struct: import("@metamask/superstruct").Struct<{ "@@MARSHALED_ERROR": true; code: "STREAM_READ_ERROR"; data: { vatId: string; kernelId?: undefined; } | { vatId?: undefined; kernelId?: undefined; } | { kernelId: string; vatId?: undefined; }; message: string; cause: import("../types.mjs").MarshaledError; stack?: string | undefined; }, { code: import("@metamask/superstruct").Struct<"STREAM_READ_ERROR", "STREAM_READ_ERROR">; data: import("@metamask/superstruct").Struct<{ vatId: string; kernelId?: undefined; } | { vatId?: undefined; kernelId?: undefined; } | { kernelId: string; vatId?: undefined; }, null>; cause: import("@metamask/superstruct").Struct<import("../types.mjs").MarshaledError, unknown>; "@@MARSHALED_ERROR": import("@metamask/superstruct").Struct<true, true>; message: import("@metamask/superstruct").Struct<string, null>; stack: import("@metamask/superstruct").Struct<string | undefined, null>; }>; /** * Unmarshals a {@link MarshaledError} into a {@link StreamReadError}. * * @param marshaledError - The marshaled error to unmarshal. * @param unmarshalErrorOptions - A function to unmarshal the error options. * @returns The unmarshaled error. */ static unmarshal(marshaledError: MarshaledOcapError, unmarshalErrorOptions: (marshaledError: MarshaledOcapError) => ErrorOptionsWithStack): StreamReadError; } export {}; //# sourceMappingURL=StreamReadError.d.mts.map