Size: 1125
Comment: __str__ section no longer necessary, answered question, added "See Also".
|
Size: 1085
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
I (LionKimbro) don't know much about writing exception classes; Here's hoping someone rewrites this better. |
|
Line 21: | Line 19: |
except HostNotFound, X: | except HostNotFound, exc: |
Line 23: | Line 21: |
# "X" is the HostNotFound instance. | print exc # -> 'Host Not Found exception: missing taoriver.net' print exc.host # -> 'taoriver.net |
Line 33: | Line 33: |
* When you're logging exceptions, you want access to the traceback information to. After some research, I believe what you use is extract_tb or extract_stack from the traceback module. -- 216.254.10.130 [[DateTime(2003-09-07T15:23:43Z)]] | * When you're logging exceptions, you want access to the traceback information to. After some research, I believe what you use is extract_tb or extract_stack from the traceback module. -- LionKimbro [[DateTime(2003-09-07T15:23:43Z)]] |
Writing Exception Classes
Exception classes are not special, you just derive them from Exception:
You may later write:
See Also
HandlingExceptions, TracebackModule
Questions
How do you relay the traceback information? Relay the traceback information? Moving it higher up the call-stack? Could you try to explain your question?
When you're logging exceptions, you want access to the traceback information to. After some research, I believe what you use is extract_tb or extract_stack from the traceback module. -- LionKimbro DateTime(2003-09-07T15:23:43Z)
- What better exception-foo is out there?