Skip to content

Commit

Permalink
fix: handle APIException when rest_framework is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
rmustafa-cocus authored and Radi85 committed Sep 12, 2020
1 parent ac5e2ef commit 31423c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions comment/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from rest_framework.exceptions import APIException
from rest_framework.status import HTTP_400_BAD_REQUEST
try:
from rest_framework.exceptions import APIException
except ModuleNotFoundError:
APIException = Exception


class CommentBadRequest(APIException):
status_code = HTTP_400_BAD_REQUEST
status_code = 400
default_detail = 'Bad Request'

def __init__(self, detail=None, status_code=None):
Expand Down

0 comments on commit 31423c6

Please sign in to comment.