MCPcopy Create free account
hub / github.com/Effect-TS/effect / catchDecodingWithContext

Function catchDecodingWithContext

packages/effect/src/Schema.ts:5436–5441  ·  view source on GitHub ↗
(
  f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, R>
)

Source from the content-addressed store, hash-verified

5434 * @since 4.0.0
5435 */
5436export function catchDecodingWithContext<S extends Constraint, R = never>(
5437 f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, R>
5438) {
5439 return (self: S): middlewareDecoding<S, S["DecodingServices"] | R> =>
5440 middlewareDecoding<S, S["DecodingServices"] | R>(Effect.catchEager(f))(self)
5441}
5442
5443/**
5444 * Recovers from an encoding error by providing a fallback value.

Callers 1

catchDecodingFunction · 0.85

Calls 1

middlewareDecodingFunction · 0.70

Tested by

no test coverage detected