django-rest-framework/djangorestframework/exceptions.py
2012-08-25 13:43:28 +01:00

23 lines
590 B
Python

from djangorestframework import status
class ParseError(Exception):
status_code = status.HTTP_400_BAD_REQUEST
default_detail = 'Malformed request'
def __init__(self, detail=None):
self.detail = detail or self.default_detail
class PermissionDenied(Exception):
status_code = status.HTTP_403_FORBIDDEN
default_detail = 'You do not have permission to access this resource.'
def __init__(self, detail=None):
self.detail = detail or self.default_detail
# class Throttled(Exception):
# def __init__(self, detail):
# self.detail = detail