aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/exceptions.py
diff options
context:
space:
mode:
authorTom Christie2013-01-26 21:37:43 +0000
committerTom Christie2013-01-26 21:37:43 +0000
commitb5d8f50f9dcace3ad3c708ed518f23ff260f6bea (patch)
tree7a0fb931ad5841b863359719075dd55f8370b3a1 /rest_framework/exceptions.py
parent4eb5861f3676781493af29f8e9fd87ec22e591aa (diff)
parenta75db4cfb8ed756c451bfda7ea0c73a73859216f (diff)
downloaddjango-rest-framework-b5d8f50f9dcace3ad3c708ed518f23ff260f6bea.tar.bz2
Merge branch 'master' into many-fields
Diffstat (limited to 'rest_framework/exceptions.py')
-rw-r--r--rest_framework/exceptions.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py
index 89479deb..d635351c 100644
--- a/rest_framework/exceptions.py
+++ b/rest_framework/exceptions.py
@@ -23,6 +23,22 @@ class ParseError(APIException):
self.detail = detail or self.default_detail
+class AuthenticationFailed(APIException):
+ status_code = status.HTTP_401_UNAUTHORIZED
+ default_detail = 'Incorrect authentication credentials.'
+
+ def __init__(self, detail=None):
+ self.detail = detail or self.default_detail
+
+
+class NotAuthenticated(APIException):
+ status_code = status.HTTP_401_UNAUTHORIZED
+ default_detail = 'Authentication credentials were not provided.'
+
+ def __init__(self, detail=None):
+ self.detail = detail or self.default_detail
+
+
class PermissionDenied(APIException):
status_code = status.HTTP_403_FORBIDDEN
default_detail = 'You do not have permission to perform this action.'