(
to: To,
transformation?: {
readonly decode: SchemaGetter.Getter<To["Encoded"], From["Type"], RD>
readonly encode: SchemaGetter.Getter<From["Type"], To["Encoded"], RE>
} | undefined
)
| 5408 | * with a fallback value or re-fails with a (possibly different) issue. The |
| 5409 | * handler's services are added to the schema's decoding services. |
| 5410 | * |
| 5411 | * @see {@link catchDecoding} for recovery handlers that do not require services |
| 5412 | * @see {@link middlewareDecoding} for intercepting or replacing the full decoding pipeline |
| 5413 | * |
| 5414 | * @category error handling |
| 5415 | * @since 4.0.0 |
| 5416 | */ |
| 5417 | export function catchDecodingWithContext<S extends Constraint, R = never>( |
| 5418 | f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, R> |
| 5419 | ) { |
| 5420 | return (self: S): middlewareDecoding<S, S["DecodingServices"] | R> => |
| 5421 | middlewareDecoding<S, S["DecodingServices"] | R>(Effect.catchEager(f))(self) |
| 5422 | } |
| 5423 | |
| 5424 | /** |
| 5425 | * Recovers from an encoding error by providing a fallback value. |
| 5426 | * |
| 5427 | * **Details** |
| 5428 | * |
| 5429 | * The handler receives the `Issue` and returns an `Effect` that either |
| 5430 | * succeeds with a fallback value or re-fails with a (possibly different) issue. |
| 5431 | * |
| 5432 | * @see {@link catchEncodingWithContext} to add service requirements to the handler |
| 5433 | * @category error handling |
no test coverage detected
searching dependent graphs…