[Qt-interest] qt and exception handling

Benjamin bebl at mageta.org
Mon Aug 1 21:22:20 CEST 2011


Hej folks,

I got a little problem with finding the right exception-handling-policy, 
maybe you can help me.
I developed a litte tool which is used by both, windows- and 
linux-users. Within the code I have some "dead-end-states", which are 
states that I can think of, but can not think of a "good" solution to 
handle them (mostly triggered by improper use of function, e.g. 
"switch(foo) { ...; default: oops(); }").
Till now I solved this by throwing a exception and not catch it later. 
This will crash the program and linux will print a short message to 
stderr, where the crash occurred and what the reason was (the given 
exception-parameters). Windows prints nothing, but shows a 
failure-message (I don't know if there is any way to get the 
reason/place of the crash under windows).

So.. one of the users of the tool reported yesterday (after weeks with 
nothing but praise ;) ) that it crashed with some strange 
failure-message (windows). I can't track this down, because I have 
nothing to work with, since windows doesn't show any useful information. 
That's the reason why I would like to implement a policy which at least 
writes the exception (place and reason) into a log-file or something 
like this (maybe even a core-dump.. that would be heavenlies :D).

Provides qt a way to do so or knows someone of you a good way to handle 
this? The exceptions can occur in multiple threads.

Thanks for reading. I hope my English wasn't that terrible.

best regards,
- Ben



More information about the Qt-interest-old mailing list