471,356 Members | 1,682 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

How to know more about an exception?

Hi,
I has a question about exception in python.
I know that an exception can be re-raised.
Is there any simple way provided by python itself that I can know the current exception is
just firstly occurred or it is re-raised by previous exception?
I need to know whether the exception is firstly occurred or not because I want to just display an error message if it's
firstly occur and skip display error message if it is just re-raised by previous exception.

Thanks!

Nov 4 '07 #1
1 1118
Timmy schrieb:
Hi,
I has a question about exception in python.
I know that an exception can be re-raised.
Is there any simple way provided by python itself that I can know the current exception is
just firstly occurred or it is re-raised by previous exception?
I need to know whether the exception is firstly occurred or not because I want to just display an error message if it's
firstly occur and skip display error message if it is just re-raised by previous exception.
No, that's not possible. What you can do is either

- wrap the exception instead of re-raising it

- set some property on the exception before re-raising.
Diez
Nov 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Lindon | last post: by
10 posts views Thread by tony | last post: by
6 posts views Thread by damod.php | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.