-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathexceptions.py
78 lines (44 loc) · 1.28 KB
/
exceptions.py
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
70
71
72
73
74
75
76
77
78
class InaccessibleInterface(Exception):
pass
class NetworkError(Exception):
pass
class HttpRequestError(NetworkError):
status: int
reason: str
def __init__(self, status: int, reason: str) -> None:
self.status = status
self.reason = reason
def __repr__(self) -> str:
return f"<HttpRequestException status={self.status} reason={self.reason}>"
class ParserException(Exception): # 解析器错误..我希望你永远不会用到这个
pass
class ActionFailed(Exception):
pass
class InvalidAuthentication(Exception):
pass
class UnsupportedOperation(ActionFailed):
pass
class InvalidOperation(ActionFailed):
pass
class AccountMuted(Exception):
pass
class AccountDeleted(Exception):
pass
class TooLongMessage(Exception):
pass
class UnknownTarget(Exception):
pass
class ContextError(Exception):
pass
class RemoteError(Exception):
pass
class UnknownError(Exception):
"""其他错误"""
class DeprecatedError(Exception):
"""该接口已弃用."""
def permission_error_message(operator: str, current: str, required: list[str]):
return (
f"missing permission: {operator} required "
+ " or ".join(f'"{i}"' for i in required)
+ f" but current is {current}"
)