-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathexceptions.py
More file actions
32 lines (25 loc) · 827 Bytes
/
exceptions.py
File metadata and controls
32 lines (25 loc) · 827 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
30
31
32
"""
Exceptions representing invalid configurations.
"""
class InvalidConfigError(Exception):
"""
Exception thrown from ``load_yaml`` and ``load_yaml_dict`` if config file is invalid. This can be due to.
* Missing fields
* Incompatible types
* Unknown fields
"""
def __init__(self, message: str, details: list[str] | None = None) -> None:
super().__init__()
self.message = message
self.details = details
self.attempted_revision: int | None = None
def __str__(self) -> str:
"""
Underlying message prefixed with 'Invalid config:'.
"""
return f"Invalid config: {self.message}"
def __repr__(self) -> str:
"""
Underlying message prefixed with 'Invalid config:'.
"""
return self.__str__()