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

Inspect source of exception and filter out of module scope #40

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Except changed to excert Exception for publish
  • Loading branch information
kompotkot committed Apr 27, 2021
commit aa994bceb12e86c0010adbc994f9ea9be55ed2b8
8 changes: 2 additions & 6 deletions python/humbug/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def publish(self, report: Report, wait: bool = False) -> None:
timeout=self.timeout_seconds,
)
self.report_futures.append(report_future)
except:
except Exception:
pass

def custom_report(
Expand Down Expand Up @@ -394,15 +394,11 @@ def setup_excepthook(
if not self.is_excepthook_set:
original_excepthook = sys.excepthook

if modules_whitelist is None:
modules_whitelist = []
modules_whitelist.append(self.name)

def _hook(exception_type, exception_instance, traceback):
original_excepthook(exception_type, exception_instance, traceback)

module = inspect.getmodule(exception_type)
if module is not None:
if module is not None and modules_whitelist is not None:
for module_whitelist in modules_whitelist:
if not module.__name__.startswith(module_whitelist):
return
Expand Down