Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format ExceptionGroup traceback #6919

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions edb/server/protocol/execute.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ cdef bytes _encode_args(list args):


cdef _check_for_ise(exc):
# Unwrap ExceptionGroup that has only one Exception
if isinstance(exc, BaseExceptionGroup) and len(exc.exceptions) == 1:
exc = exc.exceptions[0]

if not isinstance(exc, errors.EdgeDBError):
nexc = errors.InternalServerError(
f'{type(exc).__name__}: {exc}',
Expand All @@ -670,6 +674,8 @@ cdef _check_for_ise(exc):
formatted = getattr(exc, '__formatted_error__', None)
if formatted:
nexc.__formatted_error__ = formatted
if isinstance(exc, BaseExceptionGroup):
nexc.__cause__ = exc.with_traceback(None)
exc = nexc

return exc
Expand Down