WorkerError
Typed error model for worker APIs.
This module defines the WorkerError wrapper, the reason variants for spawn, send, receive, and unknown worker failures, a schema union for those reasons, and a guard for recognizing worker errors at runtime.
Errors
WorkerError
Added in v4.0.0
Source
Signature
declare class WorkerError extends { readonly _tag: "WorkerError"; readonly reason: WorkerSpawnError | WorkerSendError | WorkerReceiveError | WorkerUnknownError;} & YieldableError<this> { constructor(props: { readonly reason: WorkerErrorReason; }); readonly "~effect/workers/WorkerError": "~effect/workers/WorkerError"; message: string;}WorkerErrorReason type
Added in v4.0.0
Source
Union of the specific failure reasons that can be wrapped by a WorkerError.
Signature
type WorkerErrorReason = | WorkerSpawnError | WorkerSendError | WorkerReceiveError | WorkerUnknownError;WorkerReceiveError
Added in v4.0.0
Source
Worker error reason for failures while receiving or handling a message from a worker.
Signature
declare class WorkerReceiveError extends { readonly _tag: "WorkerReceiveError"; readonly cause?: unknown; readonly message: string;} & YieldableError<this> { constructor(...args: [props: { readonly _tag?: "WorkerReceiveError"; readonly cause?: unknown; readonly message: string; }, options?: MakeOptions]);}WorkerSendError
Added in v4.0.0
Source
Worker error reason for failures while sending a message to a worker.
Signature
declare class WorkerSendError extends { readonly _tag: "WorkerSendError"; readonly cause?: unknown; readonly message: string;} & YieldableError<this> { constructor(...args: [props: { readonly _tag?: "WorkerSendError"; readonly cause?: unknown; readonly message: string; }, options?: MakeOptions]);}WorkerSpawnError
Added in v4.0.0
Source
Worker error reason for failures while spawning or setting up a worker.
Signature
declare class WorkerSpawnError extends { readonly _tag: "WorkerSpawnError"; readonly cause?: unknown; readonly message: string;} & YieldableError<this> { constructor(...args: [props: { readonly _tag?: "WorkerSpawnError"; readonly cause?: unknown; readonly message: string; }, options?: MakeOptions]);}WorkerUnknownError
Added in v4.0.0
Source
Worker error reason for an unclassified worker failure.
Signature
declare class WorkerUnknownError extends { readonly _tag: "WorkerUnknownError"; readonly cause?: unknown; readonly message: string;} & YieldableError<this> { constructor(...args: [props: { readonly _tag?: "WorkerUnknownError"; readonly cause?: unknown; readonly message: string; }, options?: MakeOptions]);}Guards
isWorkerError
Added in v4.0.0
Source
Returns true when a value is a WorkerError.
Signature
declare function isWorkerError(u: unknown): u is WorkerError;Schemas
WorkerErrorReason
Added in v4.0.0
Source
Schema for decoding and encoding all supported worker error reason variants.
Signature
declare const WorkerErrorReason: Union< [ typeof WorkerSpawnError, typeof WorkerSendError, typeof WorkerReceiveError, typeof WorkerUnknownError, ]>;
Error raised by worker APIs, wrapping a specific
WorkerErrorReasonand exposing its message and cause.