コード例 #1
0
ファイル: __init__.py プロジェクト: zjw0358/bugsnag-python
    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)
コード例 #2
0
ファイル: __init__.py プロジェクト: bugsnag/bugsnag-python
    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)
コード例 #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
コード例 #4
0
ファイル: __init__.py プロジェクト: 8bitduck/bugsnag-python
    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)
コード例 #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)
コード例 #6
0
ファイル: __init__.py プロジェクト: kylef/bugsnag-python
    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)
コード例 #7
0
ファイル: request_controller.py プロジェクト: hsky77/hostray
    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)
コード例 #8
0
ファイル: web.py プロジェクト: 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)
コード例 #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()
コード例 #10
0
ファイル: baseserver.py プロジェクト: cnelsonsic/SimpleMMO
 def _handle_request_exception(self, e):
     if client:
         client.captureException()
     RequestHandler._handle_request_exception(self, e)
コード例 #11
0
ファイル: baseserver.py プロジェクト: cnelsonsic/SimpleMMO
 def _handle_request_exception(self, e):
     if client:
         client.captureException()
     RequestHandler._handle_request_exception(self, e)