8
8
except ImportError :
9
9
from django .core .urlresolvers import resolve
10
10
11
- from sentry_sdk import get_current_hub , configure_scope , capture_exception
11
+ from sentry_sdk import get_current_hub , capture_exception
12
12
from sentry_sdk .hub import _internal_exceptions , _should_send_default_pii
13
13
from ._wsgi import RequestExtractor , get_client_ip
14
14
from . import Integration
@@ -45,10 +45,10 @@ def sentry_patched_get_response(self, request):
45
45
lambda : make_event_processor (request )
46
46
)
47
47
48
- with configure_scope () as scope :
49
- scope . transaction = resolve ( request . path ). func . __name__
50
-
51
- return old_get_response ( self , request )
48
+ try :
49
+ return old_get_response ( self , request )
50
+ except Exception :
51
+ capture_exception ( )
52
52
53
53
BaseHandler .get_response = sentry_patched_get_response
54
54
@@ -58,6 +58,10 @@ def _make_event_processor(self, request):
58
58
client_options = get_current_hub ().client .options
59
59
60
60
def processor (event ):
61
+ if "transaction" not in event :
62
+ with _internal_exceptions ():
63
+ event ["transaction" ] = resolve (request .path ).func .__name__
64
+
61
65
with _internal_exceptions ():
62
66
DjangoRequestExtractor (request ).extract_into_event (
63
67
event , client_options
0 commit comments