aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/exceptions.py
blob: 425b4b8f0cdf96984689cf89dbdbaf1839157d45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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