Skip to content

Glossary: Building APIs with FastAPI

Exception handler

Also written: exception_handler

A function registered with `@app.exception_handler(SomeError)` that turns your own exception into a response. For example, `OutOfStock` becomes a 409 `JSONResponse`.

Where the book teaches it

Related terms

HTTPExceptionJSONResponse