GitHub

HttpApiSchemaError

API reference for HttpApiSchemaError.

A request part (Params, Headers, Query, Payload) that did not decode, answered with 400 and not reported; or a response part (Body, ResponseHeaders) that did not encode, answered with 500 and reported.

Attributes

AttributeTypeDescription
kindSchemaErrorKind
causeS.SchemaError
detailsbool = field(default=False, kw_only=True, repr=False, compare=False)

The 400 sends {"_tag", "kind", "message"}, the message being the schema issue (builder.layer(api, schema_error_details=True)). A 500 stays empty.

report_ignoredbool = field(init=False, repr=False, compare=False)
messagestr

Functions

__init__

__init__(kind, cause, *, details=False) -> None
ParameterTypeDescription
kindSchemaErrorKind
causeS.SchemaError
detailsbool = False

wrap

wrap[A, R](kind, effect) -> Effect[A, HttpApiSchemaError, R]

effect failing with this error of kind instead.

ParameterTypeDescription
kindSchemaErrorKind
effectEffect[A, S.SchemaError, R]

Returns Effect[A, HttpApiSchemaError, R]

@staticmethod
def wrap[A, R](
    kind: SchemaErrorKind, effect: Effect[A, S.SchemaError, R]
) -> Effect[A, HttpApiSchemaError, R]:
    """``effect`` failing with this error of ``kind`` instead."""
    require_effect(effect, "effect")
    return effect.map_error(lambda error: HttpApiSchemaError(kind, error))