def publish_all(self): while True: try: event = self.queue.popleft() except IndexError: break # Get subscribers to event and invoke them. The normal way to do # this in Pyramid is to invoke `registry.notify`, but that provides # no guarantee about the order of execution and any failure causes # later subscribers not to run. # # Here we wrap each subscriber call in an exception handler to # make failure independent in non-debug environments. subscribers = _get_subscribers(self.request.registry, event) for subscriber in subscribers: try: subscriber(event) except Exception: if event.request.debug: raise report_exception()
def test_exc_defaults_to_None(self, sentry_sdk): report_exception() sentry_sdk.capture_exception.assert_called_once_with(None)
def test_it_reports_the_exception_to_Sentry(self, sentry_sdk): exc = ValueError("Test exception") report_exception(exc) sentry_sdk.capture_exception.assert_called_once_with(exc)