22 __all__ = [
"register",
"ExceptionMeta",
"Exception",
"LogicError",
23 "DomainError",
"InvalidParameterError",
"LengthError",
24 "OutOfRangeError",
"RuntimeError",
"RangeError",
"OverflowError",
25 "UnderflowError",
"NotFoundError",
"IoError",
"TypeError",
26 "translate",
"declare"]
30 from .
import exceptions
36 """A Python decorator that adds a Python exception wrapper to the registry that maps C++ Exceptions 37 to their Python wrapper classes. 39 registry[cls.WrappedClass] = cls
44 """A metaclass for custom exception wrappers, which adds lookup of class attributes 45 by delegating to the Swig-generated wrapper. 49 return getattr(cls.WrappedClass, name)
54 """The base class for Python-wrapped LSST C++ exceptions. 59 __module__ =
"lsst.pex.exceptions" 70 super(Exception, self).
__init__(message)
74 return getattr(self.
cpp, name)
77 return "%s('%s')" % (
type(self).__name__, self.
cpp.
what())
80 return self.
cpp.asString()
144 """Translate a C++ Exception instance to Python and return it.""" 145 PyType = registry.get(
type(cpp),
None)
147 warnings.warn(
"Could not find appropriate Python type for C++ Exception")
152 def declare(module, exception_name, base, wrapped_class):
153 """Declare a new exception.""" 155 dict(WrappedClass=wrapped_class))))
Reports attempts to exceed implementation-defined length limits for some classes. ...
def __getattr__(self, name)
Reports arguments outside the domain of an operation.
Provides consistent interface for LSST exceptions.
Reports errors in external input/output operations.
Reports attempts to access elements using an invalid key.
virtual char const * what(void) const noexcept
Return a character string summarizing this exception.
Reports when the result of an arithmetic operation is too large for the destination type...
Reports when the result of an arithmetic operation is too small for the destination type...
Reports errors in the logical structure of the program.
Reports attempts to access elements outside a valid range of indices.
def __init__(self, arg, args, kwds)
def declare(module, exception_name, base, wrapped_class)
Reports invalid arguments.
Reports errors from accepting an object of an unexpected or inappropriate type.
Reports when the result of an operation cannot be represented by the destination type.
Reports errors that are due to events beyond the control of the program.