Error-handling facilities.
parselglossy.exceptions.
Error
(address=(), message='')[source]¶Bases: parselglossy.exceptions.Error
Detailed error reporting for dictionaries.
address
¶The keys needed to access the offending element in the dict.
Tuple
message
¶The error message.
str
Notes
As we need to support Python 3.6, we cannot use the defaults field of
namedtuple
or dataclass
.
parselglossy.exceptions.
ParselglossyError
[source]¶Bases: Exception
Exception raised when parsing fails.
parselglossy.exceptions.
collate_errors
(*, when: str, errors: List[parselglossy.exceptions.Error]) → str[source]¶Collate a list of error into an informative message.
when (str) – When the error occurred.
errors (List[Error]) – List of errors.
msg – An error message with details about where in the dictionary the error arose and what the error is. For example:
Error(s) occurred when fixing defaults:
- At 'user['scf']['another_number']'
KeyError 'min_num_iterations' in closure
'user['scf']['min_num_iterations'] / 2'
str