P
Phlip
Pythonistas:
I need to do this:
try:
deep_arcane_layer()
except e:
e.message = 'the deep arcane layer says: ' + e.message
raise e
The point is I need to augment that layer's exceptions with extra
information that I know about that layer.
I naturally cannot use the argless version of 'raise', because it only
re-raises whatever exception object is currently in play - and it
appears to be read-only or locked or something.
I also should not do this...
raise Exception('blah ' + e.message)
....because that stripped off the exception type itself, and higher
layers need to know this.
My question is a common pattern in layered architectures, where
exceptions get decorated with extra info as they bubble up from the
engine room to the bridge. Any ideas?
I need to do this:
try:
deep_arcane_layer()
except e:
e.message = 'the deep arcane layer says: ' + e.message
raise e
The point is I need to augment that layer's exceptions with extra
information that I know about that layer.
I naturally cannot use the argless version of 'raise', because it only
re-raises whatever exception object is currently in play - and it
appears to be read-only or locked or something.
I also should not do this...
raise Exception('blah ' + e.message)
....because that stripped off the exception type itself, and higher
layers need to know this.
My question is a common pattern in layered architectures, where
exceptions get decorated with extra info as they bubble up from the
engine room to the bridge. Any ideas?