User-defined Exceptions: is self.args OK?

P

petr.jakes.tpc

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top