Skip to content

Commit

Permalink
quickfix error logging REST framework
Browse files Browse the repository at this point in the history
  • Loading branch information
valentijnscholten committed Sep 8, 2021
1 parent fdc2a2b commit 236e538
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dojo/api_v2/exception_handler.py
Expand Up @@ -2,6 +2,9 @@
from rest_framework.response import Response
from rest_framework.status import HTTP_409_CONFLICT, HTTP_500_INTERNAL_SERVER_ERROR
from rest_framework.views import exception_handler
import logging

logger = logging.getLogger(__name__)


def custom_exception_handler(exc, context):
Expand All @@ -14,6 +17,7 @@ def custom_exception_handler(exc, context):
response.status_code = HTTP_500_INTERNAL_SERVER_ERROR
response.data = {}
response.data['message'] = 'Internal server error, check logs for details'
logger.exception('Error in call to REST framework')

if isinstance(exc, RestrictedError):
response.status_code = HTTP_409_CONFLICT
Expand Down

0 comments on commit 236e538

Please sign in to comment.