aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/exceptions.py
diff options
context:
space:
mode:
authorTom Christie2014-09-05 16:29:46 +0100
committerTom Christie2014-09-05 16:29:46 +0100
commitd934824bff21e4a11226af61efba319be227f4f0 (patch)
treeb5c856cc1fdb9245bfa59db450fc2c228835e3b9 /rest_framework/exceptions.py
parentc1036c17533a3091401ff90f825571f0e6125eca (diff)
downloaddjango-rest-framework-d934824bff21e4a11226af61efba319be227f4f0.tar.bz2
Workin on
Diffstat (limited to 'rest_framework/exceptions.py')
-rw-r--r--rest_framework/exceptions.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py
index ad52d172..852a08b1 100644
--- a/rest_framework/exceptions.py
+++ b/rest_framework/exceptions.py
@@ -15,7 +15,7 @@ class APIException(Exception):
Subclasses should provide `.status_code` and `.default_detail` properties.
"""
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
- default_detail = ''
+ default_detail = 'A server error occured'
def __init__(self, detail=None):
self.detail = detail or self.default_detail
@@ -29,6 +29,11 @@ class ParseError(APIException):
default_detail = 'Malformed request.'
+class ValidationError(APIException):
+ status_code = status.HTTP_400_BAD_REQUEST
+ default_detail = 'Invalid data in request.'
+
+
class AuthenticationFailed(APIException):
status_code = status.HTTP_401_UNAUTHORIZED
default_detail = 'Incorrect authentication credentials.'
@@ -54,7 +59,7 @@ class MethodNotAllowed(APIException):
class NotAcceptable(APIException):
status_code = status.HTTP_406_NOT_ACCEPTABLE
- default_detail = "Could not satisfy the request's Accept header"
+ default_detail = "Could not satisfy the request Accept header"
def __init__(self, detail=None, available_renderers=None):
self.detail = detail or self.default_detail