Пример #1
0
 def reset_context(self, *args, **kwargs):
     """
     Resets context when request is done.
     :param T sender: the object sending the signal
     :param Exception exc: exception caused during handling.
     :param extra: extras passed by the signal.
     """
     honeybadger.reset_context()
 async def _run_app(self, scope, callback):
     # TODO: Should we check recursive middleware stacks?
     # See: https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/asgi.py#L112
     try:
         return await callback()
     except Exception as exc:
         honeybadger.notify(exception=exc, context=_as_context(scope))
         raise exc from None
     finally:
         honeybadger.reset_context()
Пример #3
0
    def __call__(self, request):
        set_request(request)
        honeybadger.begin_request(request)

        response = self.get_response(request)

        honeybadger.reset_context()
        clear_request()

        return response
 async def custom_route_handler(request: Request):
     try:
         return await original_route_handler(request)
     except exceptions.HTTPException as exc:
         raise exc from None
     except Exception as exc:
         body = await request.body()
         scope = dict(request)
         scope["body"] = body
         honeybadger.notify(exception=exc, context=asgi._as_context(scope))
         raise exc from None
     finally:
         honeybadger.reset_context()
Пример #5
0
    def wrapped_handler(aws_event, aws_context, *args, **kwargs):
        set_event(aws_event)

        honeybadger.begin_request(aws_event)
        try:
            return handler(aws_event, aws_context, *args, **kwargs)
        except Exception as e:
            honeybadger.notify(e)
            exc_info = sys.exc_info()
            clear_event()
            honeybadger.reset_context()

            #Rerase exception to proceed with normal aws error handling
            reraise(*exc_info)
Пример #6
0
 def _reset_context(self, *args, **kwargs):
     """
     Resets context when request is done.
     """
     honeybadger.reset_context()
Пример #7
0
 def process_response(self, request, response):
     honeybadger.reset_context()
     return response