diff options
| author | jacobg | 2014-04-04 10:22:02 -0400 |
|---|---|---|
| committer | jacobg | 2014-04-04 10:22:02 -0400 |
| commit | 6322feb32dceb7be67b2117686f0a7570a615294 (patch) | |
| tree | da9e2c382982fd4f96b2d0b00bc59b706937b8cf /rest_framework/exceptions.py | |
| parent | 591cf8a48c6e5ce37d205c4b7e418fb7d2c31b0f (diff) | |
| download | django-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.py | 2 |
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 |
