opterror: Errors for OptionsDict tools¶
This module provides a collection of error types relevant to the
optdict module. They are essentially the same as standard error
types such as KeyError and TypeError but with an extra
parent of OptdictError to enable catching all errors
specifically raised by this package
- exception cape.optdict.opterror.OptdictAttributeError¶
Error related to accessing attributes of
OptionsDictInherits from
AttributeErrorandOpdictError.
- exception cape.optdict.opterror.OptdictError¶
Parent error class for
optdicterrorsInherits from
Exception
- exception cape.optdict.opterror.OptdictExprError¶
Exception for invalid
@exprApplies to
optdict.optitem.getel()orOptionsDict
- exception cape.optdict.opterror.OptdictJSONError¶
Exception class for errors while parsing JSON files
Inherits from
ValueErrorandOptdictError
- exception cape.optdict.opterror.OptdictKeyError¶
Exception for missing option in
optdict.optitemInherits from
KeyErrorandOptdictError
- exception cape.optdict.opterror.OptdictNameError¶
Error for badly named options in
OptionsDictInherits from
NameErrorandOptdictError
- exception cape.optdict.opterror.OptdictTypeError¶
Exception for unexpected type of parameter in
optdict
- exception cape.optdict.opterror.OptdictValueError¶
Exception for unexpected value of parameter in
optdict
- cape.optdict.opterror.assert_isinstance(obj, cls_or_tuple, desc=None)¶
Conveniently check types
Applies
isinstance(obj, cls_or_tuple)but also constructs aTypeErrorand appropriate message if test fails.If cls is
None, no checks are performed.- Call:
>>> assert_isinstance(obj, cls, desc=None) >>> assert_isinstance(obj, cls_tuple, desc=None)
- Inputs:
- Raises:
- Versions:
2022-09-17
@ddalle: Version 1.0