Ejemplo n.º 1
0
    def _handle_request_exception(self, exc):

        options = {
            "user": {
                "id": self.request.remote_ip
            },
            "context": self._get_context(),
            "request": {
                "url": self.request.full_url(),
                "method": self.request.method,
                "arguments": self.request.arguments,
            }
        }

        # Notify bugsnag, unless it's an HTTPError that we specifically want
        # to ignore
        should_notify_bugsnag = True
        if type(exc) == HTTPError:
            ignore_status_codes = self.bugsnag_ignore_status_codes()
            if ignore_status_codes and exc.status_code in ignore_status_codes:
                should_notify_bugsnag = False

        if should_notify_bugsnag:
            bugsnag.auto_notify(exc, **options)

        # Call the parent handler
        RequestHandler._handle_request_exception(self, exc)
Ejemplo n.º 2
0
    def _handle_request_exception(self, exc):

        options = {
            "user": {"id": self.request.remote_ip},
            "context": self._get_context(),
            "request": {
                "url": self.request.full_url(),
                "method": self.request.method,
                "arguments": self.request.arguments,
            },
            "severity_reason": {
                "type": "unhandledExceptionMiddleware",
                "attributes": {
                    "framework": "Tornado"
                }
            }
        }

        # Notify bugsnag, unless it's an HTTPError that we specifically want
        # to ignore
        should_notify_bugsnag = True
        if type(exc) == HTTPError:
            ignore_status_codes = self.bugsnag_ignore_status_codes()
            if ignore_status_codes and exc.status_code in ignore_status_codes:
                should_notify_bugsnag = False

        if should_notify_bugsnag:
            bugsnag.auto_notify(exc, **options)

        # Call the parent handler
        RequestHandler._handle_request_exception(self, exc)
Ejemplo n.º 3
0
    def _handle_request_exception(self, exc: BaseException):
        options = {
            "user": {
                "id": self.request.remote_ip
            },
            "context": self._get_context(),
            "request": {
                "url": self.request.full_url(),
                "method": self.request.method,
                "arguments": self.request.arguments,
            },
            "severity_reason": {
                "type": "unhandledExceptionMiddleware",
                "attributes": {
                    "framework": "Tornado"
                }
            }
        }

        # Notify bugsnag, unless it's an HTTPError that we specifically want
        # to ignore
        should_notify_bugsnag = True
        if isinstance(exc, HTTPError):
            ignore_status_codes = self.bugsnag_ignore_status_codes()
            if ignore_status_codes and exc.status_code in ignore_status_codes:
                should_notify_bugsnag = False

        if should_notify_bugsnag:
            bugsnag.auto_notify(exc, **options)

        # Call the parent handler
        RequestHandler._handle_request_exception(self, exc)  # type: ignore
Ejemplo n.º 4
0
    def _handle_request_exception(self, exc):
        # Set the request info
        bugsnag.configure_request(
            user_id=self.request.remote_ip,
            context=self._get_context(),
            request_data={
                "url": self.request.full_url(),
                "method": self.request.method,
                "arguments": self.request.arguments,
            },
        )

        # Notify bugsnag
        bugsnag.notify(exc)

        # Call the parent handler
        RequestHandler._handle_request_exception(self, exc)
Ejemplo n.º 5
0
        def _handle_request_exception(self, exc):

            options = {
                "user": {"ip": self.request.remote_ip, "id": getattr(self, "current_user_id", 0)},
                "context": self._get_context(),
                "request": {
                    "url": self.request.full_url(),
                    "method": self.request.method,
                    "arguments": self.request.arguments,
                }
            }

            # Notify bugsnag, unless it's an HTTPError that we specifically want to ignore
            should_notify_bugsnag = True
            if type(exc) == HTTPError:
                if (exc.status_code<500 and exc.status_code>=400):
                    should_notify_bugsnag = False

            if should_notify_bugsnag:
                bugsnag.auto_notify(exc, **options)

            # Call the parent handler
            _RequestHandler._handle_request_exception(self, exc)
Ejemplo n.º 6
0
    def _handle_request_exception(self, exc):

        options = {
            "user": {"id": self.request.remote_ip},
            "context": self._get_context(),
            "request": {
                "url": self.request.full_url(),
                "method": self.request.method,
                "arguments": self.request.arguments,
            },
        }

        # Notify bugsnag, unless it's an HTTPError that we specifically want to ignore
        should_notify_bugsnag = True
        if type(exc) == HTTPError:
            ignore_status_codes = self.bugsnag_ignore_status_codes()
            if ignore_status_codes and exc.status_code in ignore_status_codes:
                should_notify_bugsnag = False

        if should_notify_bugsnag:
            bugsnag.auto_notify(exc, **options)

        # Call the parent handler
        RequestHandler._handle_request_exception(self, exc)
Ejemplo n.º 7
0
    def _handle_request_exception(self, e: BaseException) -> None:
        """customized exception handling for localized messages and debug mode"""

        # convert util warning exception to HostrayWebFinish
        if issubclass(type(e), LocalizedMessageWarning):
            try:
                raise HostrayWebFinish(e.code, *e.code_args) from e
            except Exception as exc:
                e = exc

        # log to controller's log
        if not isinstance(e, HostrayWebFinish):
            self.log_error(traceback.format_exc())

        # handle tornado origin exceptions
        return RequestHandler._handle_request_exception(self, e)
Ejemplo n.º 8
0
Archivo: web.py Proyecto: rfw/entranced
 def _handle_request_exception(self, e):
     if isinstance(e, NoResultFound):
         return self.error(404, "resource not found")
     RequestHandler._handle_request_exception(self, e)
Ejemplo n.º 9
0
 def _handle_request_exception(self, e):
     RequestHandler._handle_request_exception(self,e)
     if self.settings.get('debug_pdb') and not isinstance(e, socket.error):
         import pdb
         pdb.post_mortem()
Ejemplo n.º 10
0
 def _handle_request_exception(self, e):
     if client:
         client.captureException()
     RequestHandler._handle_request_exception(self, e)
Ejemplo n.º 11
0
 def _handle_request_exception(self, e):
     if client:
         client.captureException()
     RequestHandler._handle_request_exception(self, e)