Skip to content

Commit

Permalink
Exception event: 'not authentificated' was removed from analytics (#7457
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bsekachev authored Feb 8, 2024
1 parent 9f517d1 commit 8e6e46a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Server exception rest_framework.exceptions.NotAuthenticated is not logged by analytics anymore
(<https://github.com/opencv/cvat/pull/7457>)
4 changes: 4 additions & 0 deletions cvat/apps/events/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from rest_framework.renderers import JSONRenderer
from rest_framework.views import exception_handler
from rest_framework.exceptions import NotAuthenticated
from rest_framework import status
from crum import get_current_user, get_current_request

Expand Down Expand Up @@ -544,6 +545,9 @@ def handle_rq_exception(rq_job, exc_type, exc_value, tb):
def handle_viewset_exception(exc, context):
response = exception_handler(exc, context)

IGNORED_EXCEPTION_CLASSES = (NotAuthenticated, )
if isinstance(exc, IGNORED_EXCEPTION_CLASSES):
return response
# the standard DRF exception handler only handle APIException, Http404 and PermissionDenied
# exceptions types, any other will cause a 500 error
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
Expand Down

0 comments on commit 8e6e46a

Please sign in to comment.