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

Function makeErrorSchema

packages/effect/src/unstable/httpapi/HttpApiBuilder.ts:1124–1130  ·  view source on GitHub ↗
(
  endpoint: HttpApiEndpoint.Top
)

Source from the content-addressed store, hash-verified

1122}
1123
1124function makeErrorSchema(
1125 endpoint: HttpApiEndpoint.Top
1126): Schema.ConstraintEncoder<HttpServerResponse, unknown> {
1127 const schemas = HttpApiEndpoint.getErrorSchemas(endpoint).map(toResponseErrorSchema)
1128 if (schemas.length === 0) return Schema.Never
1129 return schemas.length === 1 ? schemas[0] : Schema.Union(schemas)
1130}
1131
1132function toResponseSchema(getStatus: (schema: Schema.Constraint) => number) {
1133 // WithHeaders wrappers share a single declaration AST, so they are cached by instance

Callers 1

handlerToHttpEffectFunction · 0.70

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected