add a __str__ implementation to APIException

Add a __str__ implementation to rest_framework.exceptions.APIException. This helps for logging raised exceptions. Thanks.
This commit is contained in:
jacobg 2014-04-04 10:22:02 -04:00
parent 591cf8a48c
commit 6322feb32d

View File

@ -20,6 +20,8 @@ class APIException(Exception):
def __init__(self, detail=None): def __init__(self, detail=None):
self.detail = detail or self.default_detail self.detail = detail or self.default_detail
def __str__(self):
return self.detail
class ParseError(APIException): class ParseError(APIException):
status_code = status.HTTP_400_BAD_REQUEST status_code = status.HTTP_400_BAD_REQUEST