22 from __future__
import absolute_import
24 __all__ = [
"register",
"ExceptionMeta",
"Exception",
"LogicError",
25 "DomainError",
"InvalidParameterError",
"LengthError",
26 "OutOfRangeError",
"RuntimeError",
"RangeError",
"OverflowError",
27 "UnderflowError",
"NotFoundError",
"IoError",
"TypeError",
28 "translate",
"declare"]
33 from future.utils
import with_metaclass
34 from .
import exceptions
40 """A Python decorator that adds a Python exception wrapper to the registry that maps C++ Exceptions 41 to their Python wrapper classes. 43 registry[cls.WrappedClass] = cls
48 """A metaclass for custom exception wrappers, which adds lookup of class attributes 49 by delegating to the Swig-generated wrapper. 53 return getattr(self.WrappedClass, name)
58 """The base class for Python-wrapped LSST C++ exceptions. 63 __module__ =
"lsst.pex.exceptions" 74 super(Exception, self).
__init__(message)
78 return getattr(self.
cpp, name)
81 return "%s('%s')" % (type(self).__name__, self.
cpp.what())
84 return self.
cpp.asString()
148 """Translate a C++ Exception instance to Python and return it.""" 149 PyType = registry.get(type(cpp),
None)
151 warnings.warn(
"Could not find appropriate Python type for C++ Exception")
156 def declare(module, exception_name, base, wrapped_class):
157 """Declare a new exception.""" 159 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.
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.