summaryrefslogtreecommitdiff
path: root/src/ampache/exceptions.py
blob: af0cbf045d6814b1b04486d34a7507df1e22a9f0 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
ACCESS_ERROR_CODE = 4700
AUTHENTICATION_ERROR_CODE = 4701
ACCESS_DENIED_ERROR_CODE = 4703
NOT_FOUND_ERROR_CODE = 4704
MISSING_ERROR_CODE = 4705
DEPRECIATED_ERROR_CODE = 4706
BAD_REQUEST_ERROR_CODE = 4710
FAILED_ACCESS_ERROR_CODE = 4712


class AccessException(Exception):
    """
    Happens when the API is not enabled. Error code: 4700.
    """
    pass


class AuthenticationException(Exception):
    """
    Happens in faulty authentication or when the session expires.
    Error code: 4701.
    """
    pass


class AccessDeniedException(Exception):
    """
    Happens when the request method is not enabled. Error code: 4703
    """
    pass


class NotFoundException(Exception):
    """
    Happens when the requested object couldn't be found. Error code:
    4704
    """
    pass


class MissingMethodException(Exception):
    """
    Happens when the client requests a method the API doesn't implement.
    Error code: 4705
    """
    pass


class DepreciatedMethodException(Exception):
    """
    Happens when a given method is deprecated. Error code: 4706.
    """
    pass


class BadRequestException(Exception):
    """
    Happens when the API recieves a wrongly formed request. Error code:
    4710.
    """
    pass


class FailedAccessException(Exception):
    """
    Happens when the object or method can't be accessed by a given user.
    Error code: 4712.
    """
    pass