2012-08-25 16:43:28 +04:00
|
|
|
from djangorestframework import status
|
|
|
|
|
|
|
|
|
2012-08-25 16:27:55 +04:00
|
|
|
class ParseError(Exception):
|
2012-08-25 16:43:28 +04:00
|
|
|
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
|
2012-08-27 00:55:13 +04:00
|
|
|
default_detail = 'You do not have permission to access this resource'
|
2012-08-25 16:43:28 +04:00
|
|
|
|
|
|
|
def __init__(self, detail=None):
|
|
|
|
self.detail = detail or self.default_detail
|
|
|
|
|
|
|
|
|
2012-08-27 00:55:13 +04:00
|
|
|
class UnsupportedMediaType(Exception):
|
|
|
|
status_code = 415
|
|
|
|
default_detail = 'Unsupported media type in request'
|
|
|
|
|
|
|
|
def __init__(self, detail=None):
|
|
|
|
self.detail = detail or self.default_detail
|
|
|
|
|
2012-08-25 16:43:28 +04:00
|
|
|
# class Throttled(Exception):
|
|
|
|
# def __init__(self, detail):
|
|
|
|
# self.detail = detail
|