LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Classes | Functions | Variables
lsst.pex.exceptions.wrappers Namespace Reference

Classes

class  ExceptionMeta
 
class  Exception
 
class  LogicError
 
class  DomainError
 
class  InvalidParameterError
 
class  LengthError
 
class  OutOfRangeError
 
class  RuntimeError
 
class  RangeError
 
class  OverflowError
 
class  UnderflowError
 
class  NotFoundError
 
class  MemoryError
 
class  IoError
 
class  TypeError
 
class  TimeoutError
 

Functions

def register
 
def translate
 

Variables

dictionary registry = {}
 

Function Documentation

def lsst.pex.exceptions.wrappers.register (   cls)
A Python decorator that adds a Python exception wrapper to the registry that maps C++ Exceptions
to their Python wrapper classes.

Definition at line 8 of file wrappers.py.

8 
9 def register(cls):
10  """A Python decorator that adds a Python exception wrapper to the registry that maps C++ Exceptions
11  to their Python wrapper classes.
12  """
13  registry[cls.WrappedClass] = cls
14  return cls
def lsst.pex.exceptions.wrappers.translate (   cpp)
Translate a C++ Exception instance to Python and return it.

Definition at line 111 of file wrappers.py.

112 def translate(cpp):
113  """Translate a C++ Exception instance to Python and return it."""
114  PyType = registry.get(type(cpp), None)
115  if PyType is None:
116  warnings.warn("Could not find appropriate Python type for C++ Exception")
117  PyType = Exception
118  return PyType(cpp)
119 

Variable Documentation

dictionary lsst.pex.exceptions.wrappers.registry = {}

Definition at line 6 of file wrappers.py.