mirror of
https://github.com/fastapi-practices/fastapi_best_architecture.git
synced 2025-08-18 23:11:48 +08:00
Fix background task not executed (#86)
* Fix login auth failure exception * Add background task to custom exception class * Fix branch conflicts * Update login log status to enum.
This commit is contained in:
@ -104,15 +104,14 @@ def register_exception(app: FastAPI):
|
||||
return JSONResponse(
|
||||
status_code=_get_exception_code(exc.code),
|
||||
content=response_base.fail(code=exc.code, msg=str(exc.msg), data=exc.data if exc.data else None),
|
||||
background=exc.background,
|
||||
)
|
||||
|
||||
else:
|
||||
import traceback
|
||||
|
||||
log.exception(traceback.format_exc())
|
||||
log.error(exc)
|
||||
return JSONResponse(
|
||||
status_code=500,
|
||||
content=response_base.fail(code=500, msg=traceback.format_exc())
|
||||
content=response_base.fail(code=500, msg=str(exc))
|
||||
if settings.ENVIRONMENT == 'dev'
|
||||
else response_base.fail(code=500, msg='Internal Server Error'),
|
||||
)
|
||||
|
Reference in New Issue
Block a user