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
OptionsDict
Inherits from
AttributeError
andOpdictError
.
- exception cape.optdict.opterror.OptdictError¶
Parent error class for
optdict
errorsInherits from
Exception
- exception cape.optdict.opterror.OptdictExprError¶
Exception for invalid
@expr
Applies to
optdict.optitem.getel()
orOptionsDict
- exception cape.optdict.opterror.OptdictJSONError¶
Exception class for errors while parsing JSON files
Inherits from
ValueError
andOptdictError
- exception cape.optdict.opterror.OptdictKeyError¶
Exception for missing option in
optdict.optitem
Inherits from
KeyError
andOptdictError
- exception cape.optdict.opterror.OptdictNameError¶
Error for badly named options in
OptionsDict
Inherits from
NameError
andOptdictError
- 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 aTypeError
and 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