本文整理汇总了Python中tornado.web.RequestHandler._handle_request_exception方法的典型用法代码示例。如果您正苦于以下问题:Python RequestHandler._handle_request_exception方法的具体用法?Python RequestHandler._handle_request_exception怎么用?Python RequestHandler._handle_request_exception使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.web.RequestHandler
的用法示例。
在下文中一共展示了RequestHandler._handle_request_exception方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _handle_request_exception
# 需要导入模块: from tornado.web import RequestHandler [as 别名]
# 或者: from tornado.web.RequestHandler import _handle_request_exception [as 别名]
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)
示例2: _handle_request_exception
# 需要导入模块: from tornado.web import RequestHandler [as 别名]
# 或者: from tornado.web.RequestHandler import _handle_request_exception [as 别名]
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)
示例3: _handle_request_exception
# 需要导入模块: from tornado.web import RequestHandler [as 别名]
# 或者: from tornado.web.RequestHandler import _handle_request_exception [as 别名]
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)
示例4: _handle_request_exception
# 需要导入模块: from tornado.web import RequestHandler [as 别名]
# 或者: from tornado.web.RequestHandler import _handle_request_exception [as 别名]
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)
示例5: _handle_request_exception
# 需要导入模块: from tornado.web import RequestHandler [as 别名]
# 或者: from tornado.web.RequestHandler import _handle_request_exception [as 别名]
def _handle_request_exception(self, e):
if isinstance(e, NoResultFound):
return self.error(404, "resource not found")
RequestHandler._handle_request_exception(self, e)
示例6: _handle_request_exception
# 需要导入模块: from tornado.web import RequestHandler [as 别名]
# 或者: from tornado.web.RequestHandler import _handle_request_exception [as 别名]
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()
示例7: _handle_request_exception
# 需要导入模块: from tornado.web import RequestHandler [as 别名]
# 或者: from tornado.web.RequestHandler import _handle_request_exception [as 别名]
def _handle_request_exception(self, e):
if client:
client.captureException()
RequestHandler._handle_request_exception(self, e)