File tree Expand file tree Collapse file tree
tests/contrib/django/testapp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434import time
3535
3636from django .contrib .auth .models import User
37+ from django .db import DatabaseError
38+ from django .db .models import QuerySet
3739from django .http import HttpResponse , StreamingHttpResponse
3840from django .shortcuts import get_object_or_404 , render
3941from django .views import View
40- from django .db .models import QuerySet
41- from django .db import DatabaseError
4242
4343import elasticapm
4444
@@ -74,16 +74,18 @@ def django_exc(request):
7474
7575def django_queryset_error (request ):
7676 """Simulation of django ORM timeout"""
77+
7778 class CustomQuerySet (QuerySet ):
7879 def all (self ):
7980 raise DatabaseError ()
80-
81+
8182 def __repr__ (self ) -> str :
8283 return str (self ._result_cache )
8384
8485 qs = CustomQuerySet ()
8586 list (qs .all ())
8687
88+
8789def raise_exc (request ):
8890 raise MyException (request .GET .get ("message" , "view exception" ))
8991
You can’t perform that action at this time.
0 commit comments