-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy patherrors.py
More file actions
161 lines (99 loc) · 3.97 KB
/
errors.py
File metadata and controls
161 lines (99 loc) · 3.97 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from typing import Any, Union
class KnownError(Exception):
inner = None
def __init__(self, message: str, inner: Union[Any, None] = None):
super().__init__(message)
self.inner = inner
def get_pretty(self) -> str:
if self.inner:
return f"""{self}
... {self.inner}
"""
return str(self)
class ProgrammingError(KnownError):
pass
class DownloadError(KnownError):
pass
class BadUrlError(DownloadError):
pass
class UnknownArchiveType(KnownError):
pass
class DependencyMissing(KnownError):
def __init__(self, name: str, tag: str):
super().__init__(f"Dependency missing: {name} {tag}")
class DependenciesMissing(KnownError):
def __init__(self, dependencies: list[tuple[str, str]]):
message = "Dependencies missing: \n"
for dependency in dependencies:
message += f"{dependency[0]} {dependency[1]}\n"
super().__init__(message.rstrip("\n"))
class UnknownDependency(KnownError):
def __init__(self, name: str):
super().__init__(f"Unknown dependency: {name}")
class BadDependencyResolution(ProgrammingError):
def __init__(self, dependency: str, resolution: Any):
super().__init__(f"Bad dependency resolution for {dependency}: {resolution}")
class BadDirectory(KnownError):
def __init__(self, directory: str):
super().__init__(f"Bad directory: {directory}")
class PlatformNotSupported(KnownError):
def __init__(self, action_or_item: str, platform: str):
super().__init__(f"[{action_or_item}] is not supported on platform [{platform}].")
class BadInputError(KnownError):
def __init__(self, input: str, message: str):
super().__init__(f"Bad input [{input}]: {message}")
class ExternalProcessError(KnownError):
def __init__(self, command_line: str, message: str):
super().__init__(
f"""External process error:
Command line: {command_line}
Output: {message}"""
)
class UnknownConfigurationError(KnownError):
def __init__(self, name: str):
super().__init__(f"Configuration entry is not known: {name}.")
class ConfigurationShouldBeUniqueError(KnownError):
def __init__(self, name: str):
super().__init__(f"Configuration entry already exists: {name}.")
class ConfigurationProtectedError(KnownError):
def __init__(self, name: str):
super().__init__(f"This configuration name is protected: {name}.")
class BadUserInput(KnownError):
def __init__(self, message: str):
super().__init__(f"Bad user input: {message}.")
class BadUsage(KnownError):
def __init__(self, message: str):
super().__init__(f"Bad usage: {message}.")
class TransactionIsNotSigned(KnownError):
def __init__(self):
super().__init__("Transaction is not signed.")
class NoWalletProvided(KnownError):
def __init__(self):
super().__init__("No wallet provided.")
class DockerMissingError(KnownError):
def __init__(self):
super().__init__("Docker is not installed! Please visit https://docs.docker.com/get-docker/ to install docker.")
class GuardianServiceError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class ArgumentsNotProvidedError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class WalletGenerationError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class QueryContractError(KnownError):
def __init__(self, message: str, inner: Any = None):
super().__init__(message, str(inner))
class IncorrectWalletError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class InvalidArgumentsError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class LedgerError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class TransactionSigningError(KnownError):
def __init__(self, message: str):
super().__init__(message)