EncodingError
Shared error type for encoding and decoding operations.
Errors
EncodingError
Error returned when an encoding or decoding operation cannot process its input.
When to use
Use when you need to handle or inspect failures from encoding or decoding operations.
Details
The error records whether the failure happened during encoding or decoding, which encoding module reported it, the original input, and a human-readable message.
See
- isEncodingError for checking whether a value is an EncodingError
Signature
declare class EncodingError extends YieldableError<this> & { readonly _tag: "EncodingError";} & Readonly<{ input: unknown; kind: "Decode" | "Encode"; message: string; module: string;}> { constructor(args: { readonly input: unknown; readonly kind: "Decode" | "Encode"; readonly message: string; readonly module: string; }); readonly "~effect/encoding/EncodingError": "~effect/encoding/EncodingError";}Guards
isEncodingError
Checks whether a value is an EncodingError.
When to use
Use to narrow an unknown value before handling it as an EncodingError from
encoding or decoding code.
Details
Returns true when the value carries the EncodingErrorTypeId marker and
narrows the value to EncodingError.
See
- EncodingError for the structured error produced by failed encoding and decoding operations
Signature
declare function isEncodingError(u: unknown): u is EncodingErrorType IDs
EncodingErrorTypeId
Type identifier stored on EncodingError values and used by
isEncodingError.
When to use
Use when implementing low-level EncodingError-compatible values that need
to carry the runtime marker.
Details
This marker is part of the runtime representation of EncodingError. Prefer
isEncodingError when narrowing unknown values.
See
- isEncodingError for the public guard that checks this marker
Signature
declare const EncodingErrorTypeId: "~effect/encoding/EncodingError"EncodingErrorTypeId type
Literal type of the EncodingErrorTypeId marker.
When to use
Use to type the marker carried by EncodingError values.
Signature
type EncodingErrorTypeId = typeof EncodingErrorTypeId