FastAPI verwerkt fouten door exceptions op te werpen die het omzet in juiste HTTP-responses. HTTPException dekt de meeste gevallen af; aangepaste exception handlers geven je controle over foutformattering op globaal niveau.
HTTPException opwerpen
fastapi HTTPException
():
item = db.get()
item:
HTTPException(status_code=, detail=)
item.is_public:
HTTPException(status_code=, detail=)
item
