-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception_handler.py
More file actions
29 lines (19 loc) · 859 Bytes
/
exception_handler.py
File metadata and controls
29 lines (19 loc) · 859 Bytes
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
class DistroValidationError(Exception):
"""Base class for distro validation errors."""
pass
class MissingFieldError(DistroValidationError):
"""Raised when a required field is missing in a distro."""
def __init__(self, field, distro_name):
super().__init__(
f"Validation Error: '{field}' is required for '{distro_name}'."
)
class DefaultDistroError(DistroValidationError):
"""Raised when there is not exactly one default distro."""
def __init__(self, count):
super().__init__(
f"Validation Error: There must be exactly one default distro set to True, found: {count}."
)
class NoDistrosError(DistroValidationError):
"""Raised when no distros are provided."""
def __init__(self):
super().__init__("Validation Error: At least one distro must be provided.")