473,382 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to tell if an exception has been caught ( from inside theexception )?


Hi everyone,

I'm writing an exception that will open a trouble ticket for certain
events. Things like network failure. I thought I would like to have it
only open a ticket if the exception is not caught. Is there a way to do
this inside the Exception? As far as I can see there are only two events
called on the exception, __init__ and __del__, both of which will be
called wether or not an exception is caught (right?)

Am I missing something, or is there a way to do this with exceptions?

Thanks!

Paul
Sep 22 '05 #1
1 1235
Paul Dale wrote:

Hi everyone,

I'm writing an exception that will open a trouble ticket for certain
events. Things like network failure. I thought I would like to have it
only open a ticket if the exception is not caught. Is there a way to do
this inside the Exception? As far as I can see there are only two events
called on the exception, __init__ and __del__, both of which will be
called wether or not an exception is caught (right?)

Am I missing something, or is there a way to do this with exceptions?


Is there some reason you can't wrap your entry point with a try:except?

e.g.

if __name__ == "__main__":
try:
main()
except OpenTicket, e:
process_open_ticket(e)
Sep 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: StepH | last post by:
Hi, I've this module : from optparse import OptionParser import re _version = "P1" def writeVar(f, line):
5
by: Jacek Dziedzic | last post by:
Hi! In my main() function I have a last-resort exception construct that looks like this: int main() { try { // ... program code }
2
by: Alex | last post by:
Hi. What would happen if an exception occurs inside a Finally block and at the same time inside the try another exception was thrown without been handled by any catch? Alejandro.
14
by: Nenad Dobrilovic | last post by:
Hi, Is it possible for exception object to be aware of it's throwing? I want to log in the text file when exeption is thrown, not when the exception object is created (because I can create...
4
by: Barry Mossman | last post by:
Hi, I am throwing an exception derived from ApplicationException as follows catch (Exception ex) { throw new MyException("message", ex); } My exception's constructor is: public...
40
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
6
by: Nick Reeves | last post by:
While developing the below code I noticed that exceptions were not working as expected. An exception is thrown inside an XML import DLL and not being caught inside the Main() code fragment,...
6
by: Vadivel Kumar | last post by:
I've a problem in handling a custom exception The following is my custom exception class: public class AppException : public Exception { public AppException (string message, Exception...
9
by: Claudio Di Flumeri | last post by:
Hello all, I've added a global exception handler to my application in this way: Sub Main() AddHandler Application.ThreadException, AddressOf ThreadException AddHandler...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.