Python Exception Wrapper and Global Registry Class
Last updated: April, 14th 2007
download: source(python)
Description:
This code shows how to use a generic registry and exception class.
The registry class (in GlobalRegistry.py) along with its retrieve and register method enable dynamic registration of objects in a unique place within the code. This dynamic registration enables us to load various (different) handlers (implemented as singletons) for different situations.
The ProdException class is a wrapper around the generic Python exception class which publishes additional information through log statements. The class also has an xml method that prints the error message as xml. When initialized the constructor takes a string part (usually a human readable message) and an error number (mainly for interpretation by other components or applications)
To run the test do: python GlobalRegistry_t.py