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

Function getSchemaErrorOrThrow

packages/effect/src/Schema.ts:1554–1569  ·  view source on GitHub ↗
(
  cause: Cause_.Cause<SchemaError>,
  message: string
)

Source from the content-addressed store, hash-verified

1552) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]> = decodeUnknownEffect
1553
1554function getSchemaErrorOrThrow(
1555 cause: Cause_.Cause<SchemaError>,
1556 message: string
1557): SchemaError {
1558 let schemaError: SchemaError | undefined
1559 for (const reason of cause.reasons) {
1560 if (!Cause_.isFailReason(reason) || !isSchemaError(reason.error)) {
1561 throw new globalThis.Error(message, { cause })
1562 }
1563 schemaError ??= reason.error
1564 }
1565 if (schemaError === undefined) {
1566 throw new globalThis.Error(message, { cause })
1567 }
1568 return schemaError
1569}
1570
1571function runSchemaErrorPromise<A>(
1572 self: Effect.Effect<A, SchemaError>

Callers 2

runSchemaErrorPromiseFunction · 0.85
runSchemaErrorSyncFunction · 0.85

Calls 1

isSchemaErrorFunction · 0.85

Tested by

no test coverage detected