# Errors Everyone Can Read

Errors Everyone Can Read: Raising Your Own Exceptions in an API, One Error Shape for the Whole API.

Updated: November 19, 2026

1. [Raising Your Own Exceptions in an API](https://www.ask-codey.com/lessons/fastapi-errors-your-own-exceptions) (Journeyman): An API's own rules raise exception classes named for each problem, such as TicketNotFound and StatusChangeNotAllowed, from plain functions that know nothing about HTTP, and @app.exception_handler turns each one into a status code and a JSON body, such as 404 or 409.
2. [One Error Shape for the Whole API](https://www.ask-codey.com/lessons/fastapi-errors-one-shape) (Journeyman): Every error an API sends can have one JSON shape, modeled on RFC 9457's problem details (a status, a title, a detail sentence and, on a 422, a list of field problems), built by one problem() function and sent by an exception handler for each kind of error, FastAPI's own 404 and 422 included, with a catch-all that answers a crash with a calm 500 and never a traceback.

Source: https://www.ask-codey.com/courses/python-web-apis/topics/fastapi-handling-errors
