-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy patherrors.py
More file actions
228 lines (140 loc) · 5.85 KB
/
errors.py
File metadata and controls
228 lines (140 loc) · 5.85 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
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)
class InvalidConfirmationSettingError(KnownError):
def __init__(self, value: str):
super().__init__(
f"Invalid confirmation setting: {value}. Valid values are: ['true', 'false', 'yes', 'no', '1', '0']."
)
class InvalidEnvironmentValue(KnownError):
def __init__(self, message: str):
super().__init__(message)
class EnvironmentProtectedError(KnownError):
def __init__(self, name: str):
super().__init__(f"This environment name is protected: {name}.")
class UnknownEnvironmentError(KnownError):
def __init__(self, name: str):
super().__init__(f"Environment entry is not known: {name}.")
class EnvironmentAlreadyExistsError(KnownError):
def __init__(self, name: str):
super().__init__(f"Environment entry already exists: {name}.")
class UnknownAddressAliasError(KnownError):
def __init__(self, name: str):
super().__init__(f"Alias is not known: {name}.")
class AliasAlreadyExistsError(KnownError):
def __init__(self, name: str):
super().__init__(f"Alias already exists: {name}.")
class AliasProtectedError(KnownError):
def __init__(self, name: str):
super().__init__(f"This environment name is protected: {name}.")
class InvalidAddressConfigValue(KnownError):
def __init__(self, message: str):
super().__init__(message)
class AddressConfigFileError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class WalletError(KnownError):
def __init__(self, message: str):
super().__init__(message)
class NetworkProviderError(KnownError):
def __init__(self, url: str, error: str):
super().__init__(f"Url = [{url}], error = {error}")
class LogLevelError(KnownError):
def __init__(self, log_level: str):
super().__init__(f"Log level not accepted: {log_level}. Choose between ['debug', 'info', 'warning', 'error'].")