LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
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.