WorkerError.ts
WorkerError.ts overview
Section titled “WorkerError.ts overview”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.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”guards
Section titled “guards”isWorkerError
Section titled “isWorkerError”Returns true when a value is a WorkerError.
Signature
declare const isWorkerError: (u: unknown) => u is WorkerErrorSince v4.0.0
models
Section titled “models”WorkerError (class)
Section titled “WorkerError (class)”Error raised by worker APIs, wrapping a specific WorkerErrorReason and
exposing its message and cause.
Signature
declare class WorkerError { constructor(props: { readonly reason: WorkerErrorReason })}Since v4.0.0
[TypeId] (property)
Section titled “[TypeId] (property)”Marks this value as a worker error for runtime guards.
Signature
readonly [TypeId]: "~effect/workers/WorkerError"Since v4.0.0
WorkerErrorReason
Section titled “WorkerErrorReason”Schema for decoding and encoding all supported worker error reason variants.
Signature
declare const WorkerErrorReason: Schema.Union< [typeof WorkerSpawnError, typeof WorkerSendError, typeof WorkerReceiveError, typeof WorkerUnknownError]>Since v4.0.0
WorkerErrorReason (type alias)
Section titled “WorkerErrorReason (type alias)”Union of the specific failure reasons that can be wrapped by a WorkerError.
Signature
type WorkerErrorReason = WorkerSpawnError | WorkerSendError | WorkerReceiveError | WorkerUnknownErrorSince v4.0.0
WorkerReceiveError (class)
Section titled “WorkerReceiveError (class)”Worker error reason for failures while receiving or handling a message from a worker.
Signature
declare class WorkerReceiveErrorSince v4.0.0
WorkerSendError (class)
Section titled “WorkerSendError (class)”Worker error reason for failures while sending a message to a worker.
Signature
declare class WorkerSendErrorSince v4.0.0
WorkerSpawnError (class)
Section titled “WorkerSpawnError (class)”Worker error reason for failures while spawning or setting up a worker.
Signature
declare class WorkerSpawnErrorSince v4.0.0
WorkerUnknownError (class)
Section titled “WorkerUnknownError (class)”Worker error reason for an unclassified worker failure.
Signature
declare class WorkerUnknownErrorSince v4.0.0
type IDs
Section titled “type IDs”TypeId (type alias)
Section titled “TypeId (type alias)”Type-level identifier used to brand WorkerError values.
Signature
type TypeId = typeof TypeIdSince v4.0.0