|
2 | 2 |
|
3 | 3 | assert UnknownError |
4 | 4 |
|
| 5 | + |
5 | 6 | class AuthenticationRequired(ApplicationError): |
6 | | - def __init__(self, data=None): |
7 | | - super().__init__(1, "Authentication required", data) |
| 7 | + def __init__(self, message="Authentication required", data=None): |
| 8 | + super().__init__(1, message, data) |
| 9 | + |
8 | 10 |
|
9 | 11 | class BackendNotAvailable(ApplicationError): |
10 | | - def __init__(self, data=None): |
11 | | - super().__init__(2, "Backend not available", data) |
| 12 | + def __init__(self, message="Backend not available", data=None): |
| 13 | + super().__init__(2, message, data) |
| 14 | + |
12 | 15 |
|
13 | 16 | class BackendTimeout(ApplicationError): |
14 | | - def __init__(self, data=None): |
15 | | - super().__init__(3, "Backend timed out", data) |
| 17 | + def __init__(self, message="Backend timed out", data=None): |
| 18 | + super().__init__(3, message, data) |
| 19 | + |
16 | 20 |
|
17 | 21 | class BackendError(ApplicationError): |
18 | | - def __init__(self, data=None): |
19 | | - super().__init__(4, "Backend error", data) |
| 22 | + def __init__(self, message="Backend error", data=None): |
| 23 | + super().__init__(4, message, data) |
| 24 | + |
20 | 25 |
|
21 | 26 | class UnknownBackendResponse(ApplicationError): |
22 | | - def __init__(self, data=None): |
23 | | - super().__init__(4, "Backend responded in unknown way", data) |
| 27 | + def __init__(self, message="Backend responded in unknown way", data=None): |
| 28 | + super().__init__(4, message, data) |
| 29 | + |
24 | 30 |
|
25 | 31 | class TooManyRequests(ApplicationError): |
26 | | - def __init__(self, data=None): |
27 | | - super().__init__(5, "Too many requests. Try again later", data) |
| 32 | + def __init__(self, message="Too many requests. Try again later", data=None): |
| 33 | + super().__init__(5, message, data) |
| 34 | + |
28 | 35 |
|
29 | 36 | class InvalidCredentials(ApplicationError): |
30 | | - def __init__(self, data=None): |
31 | | - super().__init__(100, "Invalid credentials", data) |
| 37 | + def __init__(self, message="Invalid credentials", data=None): |
| 38 | + super().__init__(100, message, data) |
| 39 | + |
32 | 40 |
|
33 | 41 | class NetworkError(ApplicationError): |
34 | | - def __init__(self, data=None): |
35 | | - super().__init__(101, "Network error", data) |
| 42 | + def __init__(self, message="Network error", data=None): |
| 43 | + super().__init__(101, message, data) |
| 44 | + |
36 | 45 |
|
37 | 46 | class ProtocolError(ApplicationError): |
38 | | - def __init__(self, data=None): |
39 | | - super().__init__(103, "Protocol error", data) |
| 47 | + def __init__(self, message="Protocol error", data=None): |
| 48 | + super().__init__(103, message, data) |
| 49 | + |
40 | 50 |
|
41 | 51 | class TemporaryBlocked(ApplicationError): |
42 | | - def __init__(self, data=None): |
43 | | - super().__init__(104, "Temporary blocked", data) |
| 52 | + def __init__(self, message="Temporary blocked", data=None): |
| 53 | + super().__init__(104, message, data) |
| 54 | + |
44 | 55 |
|
45 | 56 | class Banned(ApplicationError): |
46 | | - def __init__(self, data=None): |
47 | | - super().__init__(105, "Banned", data) |
| 57 | + def __init__(self, message="Banned", data=None): |
| 58 | + super().__init__(105, message, data) |
| 59 | + |
48 | 60 |
|
49 | 61 | class AccessDenied(ApplicationError): |
50 | | - def __init__(self, data=None): |
51 | | - super().__init__(106, "Access denied", data) |
| 62 | + def __init__(self, message="Access denied", data=None): |
| 63 | + super().__init__(106, message, data) |
| 64 | + |
52 | 65 |
|
53 | 66 | class FailedParsingManifest(ApplicationError): |
54 | | - def __init__(self, data=None): |
55 | | - super().__init__(200, "Failed parsing manifest", data) |
| 67 | + def __init__(self, message="Failed parsing manifest", data=None): |
| 68 | + super().__init__(200, message, data) |
| 69 | + |
56 | 70 |
|
57 | 71 | class TooManyMessagesSent(ApplicationError): |
58 | | - def __init__(self, data=None): |
59 | | - super().__init__(300, "Too many messages sent", data) |
| 72 | + def __init__(self, message="Too many messages sent", data=None): |
| 73 | + super().__init__(300, message, data) |
| 74 | + |
60 | 75 |
|
61 | 76 | class IncoherentLastMessage(ApplicationError): |
62 | | - def __init__(self, data=None): |
63 | | - super().__init__(400, "Different last message id on backend", data) |
| 77 | + def __init__(self, message="Different last message id on backend", data=None): |
| 78 | + super().__init__(400, message, data) |
| 79 | + |
64 | 80 |
|
65 | 81 | class MessageNotFound(ApplicationError): |
66 | | - def __init__(self, data=None): |
67 | | - super().__init__(500, "Message not found", data) |
| 82 | + def __init__(self, message="Message not found", data=None): |
| 83 | + super().__init__(500, message, data) |
| 84 | + |
68 | 85 |
|
69 | 86 | class ImportInProgress(ApplicationError): |
70 | | - def __init__(self, data=None): |
71 | | - super().__init__(600, "Import already in progress", data) |
| 87 | + def __init__(self, message="Import already in progress", data=None): |
| 88 | + super().__init__(600, message, data) |
0 commit comments