parselglossy.exceptions module#
Error-handling facilities.
- class parselglossy.exceptions.Error(address=(), message='')[source]#
Bases:
Error
Detailed error reporting for dictionaries.
- address#
The keys needed to access the offending element in the dict.
- Type
Tuple
- message#
The error message.
- Type
str
Notes
As we need to support Python 3.6, we cannot use the defaults field of
namedtuple
ordataclass
.
- exception parselglossy.exceptions.ParselglossyError[source]#
Bases:
Exception
Exception raised when parsing fails.
- parselglossy.exceptions.collate_errors(*, when: str, errors: List[Error]) str [source]#
Collate a list of error into an informative message.
- Parameters
when (str) – When the error occurred.
errors (List[Error]) – List of errors.
- Returns
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'
- Return type
str