I'm surprised no-one is mentioning what seems the obvious pattern here - 
exception wrapping.

So you define your exception class as containing the root exception.

Then your specific job routines wrap the exceptions they encounter in your 
personal exception class. This is where you go add in specific information re: 
the circumstances under which the exception occurred. 

Then you throw your exception, which is captured at the appropriate level, and 
logged appropriately.

The nice thing here is that you to tend to write all the exception logging in 
one place, instead of scattered all around.

Your code looks very close to this pattern.  Just raise an exception that can 
wrap the low level exception.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to