Skip to content

Commit 481bc5f

Browse files
committed
fix(drf): align exception metadata with SDK spec
1 parent 99268cc commit 481bc5f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎posthog/integrations/drf.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
_CAPTURE_METADATA = {
3838
"level": "error",
3939
"source": "django_rest_framework.exception_handler",
40-
"mechanism": {"type": "django_rest_framework", "handled": True},
40+
"mechanism": {"type": "middleware", "handled": True},
4141
}
4242

4343

‎posthog/test/integrations/test_drf_integration.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ServiceUnavailable(APIException):
2727

2828

2929
class TestDjangoRestFrameworkIntegration(unittest.TestCase):
30-
def test_default_handler_captures_handled_5xx(self):
30+
def test_default_handler_captures_5xx_with_canonical_metadata(self):
3131
client = Mock()
3232
handler = create_exception_handler(client=client)
3333
exception = ServiceUnavailable()
@@ -41,7 +41,7 @@ def test_default_handler_captures_handled_5xx(self):
4141
"level": "error",
4242
"source": "django_rest_framework.exception_handler",
4343
"mechanism": {
44-
"type": "django_rest_framework",
44+
"type": "middleware",
4545
"handled": True,
4646
},
4747
},
@@ -174,7 +174,7 @@ def test_module_handler_uses_global_client(self):
174174
"level": "error",
175175
"source": "django_rest_framework.exception_handler",
176176
"mechanism": {
177-
"type": "django_rest_framework",
177+
"type": "middleware",
178178
"handled": True,
179179
},
180180
},

0 commit comments

Comments
 (0)