apimodel.errors#
Pretty errors.
Module Contents#
- exception apimodel.errors.LocError(error: Exception, loc: RawLoc = '__root__')[source]#
Error with a location.
- exception apimodel.errors.ValidationError(*errors: ErrorList, model: Type[apimodel.apimodel.APIModel])[source]#
Pretty validation error inspired by pydantic.
- apimodel.errors.catch_errors(model: apimodel.tutils.MaybeType[apimodel.apimodel.APIModel]) Iterator[ErrorCatcher][source]#
Catch errors and raise a ValidationError if at least one is present.
Examples
>>> with apimodel.errors.catch_errors(model) as catcher: >>> for name, function in function: >>> with catcher.catch(loc=function.__name__): >>> function()