Skip to content

Commit c09670e

Browse files
committed
Skip recording exceptions as return type
1 parent cf8c27c commit c09670e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

record_api/core.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,18 @@ def __call__(self) -> None:
418418

419419
def log_called_method(self):
420420
if self.previous_stack.log_call_args:
421+
tos = self.TOS
422+
if type(tos) is type and issubclass(tos, Exception):
423+
# Don't record exception
424+
return
421425
filename, line, fn, args, *kwargs = self.previous_stack.log_call_args
422426
kwargs = kwargs[0] if kwargs else {}
423427
log_call(
424428
f"{filename}:{line}",
425429
fn,
426430
tuple(args),
427431
*((kwargs,) if kwargs else ()),
428-
return_type=type(self.TOS),
432+
return_type=type(tos),
429433
)
430434

431435
# special case subscr b/c we only check first arg, not both

0 commit comments

Comments
 (0)