Commit 6322feb3 by jacobg

add a __str__ implementation to APIException

Add a __str__ implementation to rest_framework.exceptions.APIException. This helps for logging raised exceptions. Thanks.
parent 591cf8a4
...@@ -20,6 +20,8 @@ class APIException(Exception): ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment