1119
Comment:
|
1196
Exceptions derive from exception. Need call parent initializer?
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
Exception classes are not special; You just write an ordinary class: | Derive Exception classes from Exception: |
Line 13: | Line 13: |
''Do we call {{{Exception.__init__( self )}}}..?'' -- LionKimbro [[DateTime(2003-09-06T19:51:18Z)]] |
Writing Exception Classes
I (LionKimbro) don't know much about writing exception classes; Here's hoping someone rewrites this better.
Derive Exception classes from Exception:
Do we call Exception.__init__( self )..? -- LionKimbro DateTime(2003-09-06T19:51:18Z)
You may later write:
Overloading __str__
You can overload __str__ to get the exception to explain itself:
That way, you only need print the exception instance:
I don't know if this is a good idea or not.
Questions
- How do you relay the traceback information?
- What better exception-foo is out there?