Skip to content

Commit 345b1a4

Browse files
committed
try to patch call_view instead
1 parent a1fc21f commit 345b1a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sentry_sdk/integrations/pyramid.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ def __init__(self, transaction_style="route_name"):
6363
@staticmethod
6464
def setup_once():
6565
# type: () -> None
66-
from pyramid.router import Router
66+
from pyramid import router
6767
from pyramid.request import Request
6868

69-
old_handle_request = Router.handle_request
69+
old_call_view = router._call_view
7070

71-
def sentry_patched_handle_request(self, request, *args, **kwargs):
71+
def sentry_patched_call_view(registry, request, *args, **kwargs):
7272
# type: (Any, Request, *Any, **Any) -> Response
7373
hub = Hub.current
7474
integration = hub.get_integration(PyramidIntegration)
@@ -81,15 +81,15 @@ def sentry_patched_handle_request(self, request, *args, **kwargs):
8181
elif integration.transaction_style == "route_pattern":
8282
scope.transaction = request.matched_route.pattern
8383
except Exception:
84-
pass
84+
raise
8585

8686
scope.add_event_processor(
8787
_make_event_processor(weakref.ref(request), integration)
8888
)
8989

90-
return old_handle_request(self, request, *args, **kwargs)
90+
return old_call_view(self, request, *args, **kwargs)
9191

92-
Router.handle_request = sentry_patched_handle_request
92+
router._call_view = sentry_patched_call_view
9393

9494
if hasattr(Request, "invoke_exception_view"):
9595
old_invoke_exception_view = Request.invoke_exception_view

0 commit comments

Comments
 (0)