Use custom API route instead of doing var = ...first()
if not var: raise HTTPException
, etc.
#218
Labels
var = ...first()
if not var: raise HTTPException
, etc.
#218
https://fastapi.tiangolo.com/how-to/custom-request-and-route/#accessing-the-request-body-in-an-exception-handler
Can then call
one()
instead offirst()
and handlesqlalchemy.orm.exc.NoResultFound
globally.Can do this in:
The text was updated successfully, but these errors were encountered: