Skip to content

Commit 9ee1b86

Browse files
committed
fix: capture django processed exceptions
1 parent 6a27102 commit 9ee1b86

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

posthog/integrations/django.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from typing import TYPE_CHECKING, cast
2-
from posthog import contexts
2+
from posthog import contexts, capture_exception
33
from posthog.client import Client
44

55
if TYPE_CHECKING:
@@ -167,3 +167,15 @@ def __call__(self, request):
167167
contexts.tag(k, v)
168168

169169
return self.get_response(request)
170+
171+
def process_exception(self, request, exception):
172+
if self.request_filter and not self.request_filter(request):
173+
return
174+
175+
if not self.capture_exceptions:
176+
return
177+
178+
if self.client:
179+
self.client.capture_exception(exception)
180+
else:
181+
capture_exception(exception)

0 commit comments

Comments
 (0)