aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/exceptions.py
diff options
context:
space:
mode:
authorjacobg2014-04-04 10:22:02 -0400
committerjacobg2014-04-04 10:22:02 -0400
commit6322feb32dceb7be67b2117686f0a7570a615294 (patch)
treeda9e2c382982fd4f96b2d0b00bc59b706937b8cf /rest_framework/exceptions.py
parent591cf8a48c6e5ce37d205c4b7e418fb7d2c31b0f (diff)
downloaddjango-rest-framework-6322feb32dceb7be67b2117686f0a7570a615294.tar.bz2
add a __str__ implementation to APIException
Add a __str__ implementation to rest_framework.exceptions.APIException. This helps for logging raised exceptions. Thanks.
Diffstat (limited to 'rest_framework/exceptions.py')
-rw-r--r--rest_framework/exceptions.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py
index 0ac5866e..5f774a9f 100644
--- a/rest_framework/exceptions.py
+++ b/rest_framework/exceptions.py
@@ -20,6 +20,8 @@ class APIException(Exception):
def __init__(self, detail=None):
self.detail = detail or self.default_detail
+ def __str__(self):
+ return self.detail
class ParseError(APIException):
status_code = status.HTTP_400_BAD_REQUEST