472,985 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,985 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 1163
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lindon | last post by:
Until now I've been programming straight console apps, and all I've been doing to compile is a simple 'gcc file1.cpp file2.cpp ....'. What more is there to know about the compiler? I'd like to know...
1
by: Robin Tucker | last post by:
I keep reading about exception handling being preferable to "return codes". I would like to implement some kind of consistent use of exceptions in my code, but am finding it hard to come up with...
7
by: Micheal | last post by:
Hi, I want to know about news groups of visual studio.net 2005 . regards micheal
10
by: tony | last post by:
Hello!! As you know every user defined exception must be derived from class Exception. Now to my question if I write catch then every exception will be caught. If I instead write...
6
by: damod.php | last post by:
hai , friends, am new one to this group, I want to know About frame works in php Which one is best i want learn any one frame work can you help me Am workin in PHP MY SQL i want to learn it....
11
by: George2 | last post by:
Hello everyone, How do you understand the Bjarne's comments about exception specification? Especially, "not required to be checked across compilation-unit" and "violations will not be caught...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.