除401,404的400错误全400返回
This commit is contained in:
parent
df19fae6ce
commit
1d4c0d4a42
|
@ -41,9 +41,12 @@ def custom_exception_hander(exc, context):
|
|||
|
||||
set_rollback()
|
||||
data['request_id'] = request_id
|
||||
return Response(data, status=exc.status_code, headers=headers)
|
||||
status = exc.status_code
|
||||
if status not in [401, 404]:
|
||||
status = 400
|
||||
return Response(data, status=status, headers=headers)
|
||||
args = (request_id, traceback.format_exc())
|
||||
myLogger.error(f"{args[0]}-{args[1]}")
|
||||
return Response(data={'err_code': 'server_error',
|
||||
'err_detail': traceback.format_exc(),
|
||||
'err_detail': '',
|
||||
'err_msg': '服务器错误', 'request_id': request_id}, status=500)
|
||||
|
|
Loading…
Reference in New Issue