blob: b29d96ba1c723ba60aafb15ba624551b69ccd3d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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 UnsupportedMediaType(Exception):
status_code = 415
default_detail = 'Unsupported media type in request'
def __init__(self, detail=None):
self.detail = detail or self.default_detail
# class Throttled(Exception):
# def __init__(self, detail):
# self.detail = detail
|