perf: 优化错误提示 (#533)

This commit is contained in:
shaohuzhang1 2024-05-24 16:18:33 +08:00 committed by GitHub
parent 2da31997e5
commit 7953706895
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,11 +65,13 @@ def find_err_detail(exc_detail):
return find_err_detail(_value) return find_err_detail(_value)
elif isinstance(_value, ErrorDetail): elif isinstance(_value, ErrorDetail):
return _value return _value
elif isinstance(_value, dict): elif isinstance(_value, dict) and len(_value.keys()) > 0:
return find_err_detail(_value) return find_err_detail(_value)
if isinstance(exc_detail, list): if isinstance(exc_detail, list):
for v in exc_detail: for v in exc_detail:
return find_err_detail(v) r = find_err_detail(v)
if r is not None:
return r
def handle_exception(exc, context): def handle_exception(exc, context):