forked from pulp/pulp_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
54 lines (38 loc) · 1.28 KB
/
Copy pathexceptions.py
File metadata and controls
54 lines (38 loc) · 1.28 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
from gettext import gettext as _
from pulpcore.plugin.exceptions import PulpException
class AttestationVerificationError(PulpException):
"""
Raised when attestation verification fails.
"""
error_code = "PYT0001"
def __init__(self, message):
super().__init__()
self.message = message
def __str__(self):
return f"[{self.error_code}] " + _("Attestation verification failed: {message}").format(
message=self.message
)
class UnsupportedProtocolError(PulpException):
"""
Raised when an unsupported protocol is used for syncing.
"""
error_code = "PYT0002"
def __init__(self, protocol):
super().__init__()
self.protocol = protocol
def __str__(self):
return f"[{self.error_code}] " + _(
"Only HTTP(S) is supported for python syncing, got: {protocol}"
).format(protocol=self.protocol)
class InvalidAttestationsError(PulpException):
"""
Raised when attestation data cannot be validated.
"""
error_code = "PYT0003"
def __init__(self, message):
super().__init__()
self.message = message
def __str__(self):
return f"[{self.error_code}] " + _("Invalid attestations: {message}").format(
message=self.message
)