Skip to content

featherweight.adapters.errors

errors

The error of an adapter that is given a request it cannot read, and how it words what is wrong. BadRequest is defined in featherweight.errors (the streaming module raises a subclass of it and cannot import this package); it is exported here too, where it always was.

BadRequest

Bases: ValueError

A client's request is not valid. A web framework can answer it with a 4xx (422): the message says what is wrong.

problems

problems(exc: ValidationError) -> str

What is wrong in a request, from a pydantic error, in the words of both adapters: one line per problem, where: what. The message of a rule of ours (a ValueError of a validator) already says where, and stands alone, without pydantic's "Value error, ". When a field takes a string or a list, the complaint that a list is not a string is left out when something else is wrong.