Skip to content

Commit

Permalink
vdk-core: fix exception cause swallowing
Browse files Browse the repository at this point in the history
Why?

report_and_throw swallows the actual exception cause if
we don't pass a cause

What?

Add condition that checks if a cause was passed

How was this tested?

CI

What kind of change is this?

Bugfix

Signed-off-by: Dilyan Marinov <[email protected]>
  • Loading branch information
Dilyan Marinov committed Nov 28, 2023
1 parent 6951f6f commit d4772f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion projects/vdk-core/src/vdk/internal/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ def report_and_throw(
exception,
)
)
raise exception from cause
if cause:
raise exception from cause
else:
raise exception


def report_and_rethrow(error_type: ResolvableBy, exception: BaseException) -> None:
Expand Down

0 comments on commit d4772f5

Please sign in to comment.