-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
54 lines (40 loc) · 1.56 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
"""
This module defines custom exceptions used in the wolfsoftware.prereqs package.
Currently, it includes a single exception class for handling errors related to
prerequisite command checks.
Classes:
PrerequisiteCheckError(Exception):
Custom exception raised when one or more prerequisite commands are not found.
Contains a list of error messages detailing the missing commands.
Usage Example:
from wolfsoftware.prereqs.exceptions import PrerequisiteCheckError
try:
raise PrerequisiteCheckError(["python is not installed", "git is not installed"])
except PrerequisiteCheckError as e:
print("Prerequisite check failed:")
for error in e.errors:
print(error)
Classes:
PrerequisiteCheckError(Exception):
Custom exception raised when one or more prerequisite commands are not found.
- __init__(self, errors: list): Initializes the exception with a list of error messages.
- errors (list): A list of error messages detailing the missing commands.
Attributes:
errors (list): A list of error messages passed during the exception initialization.
"""
class PrerequisiteCheckError(Exception):
"""
_summary_.
_extended_summary_
Arguments:
Exception (_type_): _description_
"""
def __init__(self, errors: list) -> None:
"""
_summary_.
_extended_summary_
Arguments:
errors (list): _description_
"""
self.errors: list = errors
super().__init__(f"{len(errors)} error(s) found: " + ", ".join(errors))