473,398 Members | 2,368 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,398 software developers and data experts.

cathing uncaught exceptions

how can I catch (globally) exception that were not caught in a try/
catch block in any running thread? i had this weird case that an
exception was raised in one thread, but nothing was displayed/logged.
Aug 18 '08 #1
5 1151
On Aug 18, 10:02*am, Alexandru Mosoi <brtz...@gmail.comwrote:
how can I catch (globally) exception that were not caught in a try/
catch block in any running thread? i had this weird case that an
exception was raised in one thread, but nothing was displayed/logged.
I suspect that your weird case was *not* because your exception was
uncaught, but because it *was* caught and just discarded. Look
through your code for something like this:

except ExceptionIDontExpectToEverGet:
pass

or even worse:

except:
pass

I'll bet one of these was your "exception non-logger" culprits.

-- Paul
Aug 18 '08 #2
On Aug 18, 6:18*pm, Paul McGuire <pt...@austin.rr.comwrote:
On Aug 18, 10:02*am, Alexandru *Mosoi <brtz...@gmail.comwrote:
how can I catch (globally) exception that were not caught in a try/
catch block in any running thread? i had this weird case that an
exception was raised in one thread, but nothing was displayed/logged.

I suspect that your weird case was *not* because your exception was
uncaught, but because it *was* caught and just discarded. *Look
through your code for something like this:

* * except ExceptionIDontExpectToEverGet:
* * * * pass

or even worse:

* * except:
* * * * pass

I'll bet one of these was your "exception non-logger" culprits.

-- Paul

sorry, no... i used except: print 'something' to validate that there
is an exception that was raised :). otherwise, i avoid your second
construct in my code (just because I don't want to miss strange cases
like this one).
Aug 18 '08 #3
On Aug 18, 6:02*pm, Alexandru Mosoi <brtz...@gmail.comwrote:
how can I catch (globally) exception that were not caught in a try/
catch block in any running thread? i had this weird case that an
exception was raised in one thread, but nothing was displayed/logged.
I found that normally sys.excepthook is invoked for uncaught
exceptions. however in my case the function is not invoked (as it
should normaly do). i printed the stackframe and checked that there is
no try/catch block that handles the exception. any other idea?
Aug 19 '08 #4
On Aug 18, 10:02 pm, Alexandru Mosoi <brtz...@gmail.comwrote:
how can I catch (globally) exception that were not caught in a try/
catch block in any running thread? i had this weird case that an
exception was raised in one thread, but nothing was displayed/logged.
Any chance you might have missed the word "raise", e.g.

except Exception, err:
Exception(err)

vs.

except Exception, err:
raise Exception(err)
This is from the list of stupid things I have done myself,

- Rafe
Aug 19 '08 #5
En Mon, 18 Aug 2008 12:02:29 -0300, Alexandru Mosoi <br*****@gmail.comescribió:
how can I catch (globally) exception that were not caught in a try/
catch block in any running thread? i had this weird case that an
exception was raised in one thread, but nothing was displayed/logged.
Each thread should handle its own exceptions. If any exception escapes from Threading.run(), it is printed on sys.stderr (sys.excepthook isn't involved); see the threading.py module for details.
Maybe you had a bare try/except that did nothing? or maybe you redirected sys.stderr?

--
Gabriel Genellina

Aug 19 '08 #6

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

Similar topics

0
by: F. GEIGER | last post by:
Are there any plans to let pychecker report exceptions that are not caught by a caller? I sometimes really liked a tool telling me, what exceptions a callee raises and are not caught by my code. ...
4
by: nrhayyal | last post by:
hi all, i am facing a problem in catching an exception which is uncaught in any of the catch block. not doing so will gives me coredump. I tried by rewriting set_unexpected() and set_terminate()...
3
by: c.prerovsky | last post by:
Hi there, I started messing around with JavaScript OOP a few days ago and still can't get this one to work. There are many things wich keep confusing me, eg. the various ways to define a class...
2
by: zottty | last post by:
Dear Friends, I'm struggling with my ASP.NET/C# site. I want a default error site for all the uncaught exceptions. I tried to work it out, but no success. That's what I did: Global.asax: ...
6
by: Bob | last post by:
Hi all, I have a small helper service that is peppered with try-catches for all the exceptional cases I could think of. It industriously logs every error it comes across for debugging later on....
3
by: George2 | last post by:
Hello everyone, Just want to check whether my understanding is correct, Both (1) and (2) only covers Windows C++ platform. 1. If there is uncaught exception, destructor is not ensured to...
5
by: Paul Rubin | last post by:
I think I've asked about this before, but is there a way to set up Python to handle uncaught exceptions with pdb? I know about setting sys.except_hook to something that calls pdb, but this is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.