HTTP exception that you can raise to return a specific HTTP error response.
Since this is defined in the auth module, we default to a 401 status code.
Example:
Default:
raise HTTPException()
# HTTPException(status_code=401, detail='Unauthorized')
Add headers:
raise HTTPException(headers={"X-Custom-Header": "Custom Value"})
# HTTPException(status_code=401, detail='Unauthorized', headers={"WWW-Authenticate": "Bearer"})
Custom error:
raise HTTPException(status_code=404, detail="Not found")Additional HTTP headers to include in the error response.