User-defined Exceptions: is self.args OK?
petr.jakes.tpc at gmail.com
petr.jakes.tpc at gmail.com
Wed Apr 16 12:54:27 EDT 2008
Hi,
I am trying to dig through User-defined Exceptions (http://
docs.python.org/tut/node10.html chapter 8.5)
is it OK to add following line to the __init__ method of the
TransitionError class?
....
....
self.args = (self.previous, self.next, self.message)
If I do not add this argument to the class, following code does not
include values from self.previous, self.next, self.message attributes
try:
raise TransitionError('previousFoo', 'nextBar', 'this is foo bar
message')
except TransitionError, err:
print err
import traceback, sys
print sys.exc_info()
traceback.print_exc()
Thanks for your replies.
Petr Jakes
More information about the Python-list
mailing list