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
Error raised by worker APIs, wrapping a specific WorkerErrorReason and
exposing its message and cause.
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
Union of the specific failure reasons that can be wrapped by a WorkerError.
Signature
type WorkerErrorReason = WorkerSpawnError | WorkerSendError | WorkerReceiveError | WorkerUnknownErrorWorkerReceiveError
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
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
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
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
Returns true when a value is a WorkerError.
Signature
declare function isWorkerError(u: unknown): u is WorkerErrorSchemas
WorkerErrorReason
Schema for decoding and encoding all supported worker error reason variants.
Signature
declare const WorkerErrorReason: Union<[typeof WorkerSpawnError, typeof WorkerSendError, typeof WorkerReceiveError, typeof WorkerUnknownError]>