18
18
from sentry_sdk ._compat import iteritems
19
19
20
20
try :
21
- from tornado import version_info as TORNADO_VERSION
21
+ from tornado import version_info as TORNADO_VERSION # type: ignore
22
22
from tornado .web import RequestHandler , HTTPError
23
23
from tornado .gen import coroutine
24
24
except ImportError :
@@ -53,7 +53,7 @@ def setup_once():
53
53
54
54
ignore_logger ("tornado.access" )
55
55
56
- old_execute = RequestHandler ._execute
56
+ old_execute = RequestHandler ._execute # type: ignore
57
57
58
58
awaitable = iscoroutinefunction (old_execute )
59
59
@@ -72,7 +72,8 @@ async def sentry_execute_request_handler(self, *args, **kwargs):
72
72
with Hub (hub ) as hub :
73
73
with hub .configure_scope () as scope :
74
74
scope .clear_breadcrumbs ()
75
- scope .add_event_processor (_make_event_processor (weak_handler ))
75
+ processor = _make_event_processor (weak_handler ) # type: ignore
76
+ scope .add_event_processor (processor )
76
77
return await old_execute (self , * args , ** kwargs )
77
78
78
79
else :
@@ -89,20 +90,22 @@ def sentry_execute_request_handler(self, *args, **kwargs):
89
90
90
91
with Hub (hub ) as hub :
91
92
with hub .configure_scope () as scope :
92
- scope .add_event_processor (_make_event_processor (weak_handler ))
93
+ scope .clear_breadcrumbs ()
94
+ processor = _make_event_processor (weak_handler ) # type: ignore
95
+ scope .add_event_processor (processor )
93
96
result = yield from old_execute (self , * args , ** kwargs )
94
97
return result
95
98
96
- RequestHandler ._execute = sentry_execute_request_handler
99
+ RequestHandler ._execute = sentry_execute_request_handler # type: ignore
97
100
98
101
old_log_exception = RequestHandler .log_exception
99
102
100
103
def sentry_log_exception (self , ty , value , tb , * args , ** kwargs ):
101
104
# type: (Any, type, BaseException, Any, *Any, **Any) -> Optional[Any]
102
105
_capture_exception (ty , value , tb )
103
- return old_log_exception (self , ty , value , tb , * args , ** kwargs )
106
+ return old_log_exception (self , ty , value , tb , * args , ** kwargs ) # type: ignore
104
107
105
- RequestHandler .log_exception = sentry_log_exception
108
+ RequestHandler .log_exception = sentry_log_exception # type: ignore
106
109
107
110
108
111
def _capture_exception (ty , value , tb ):
0 commit comments