[Qt-interest] Qt and exceptions
Stephan Rose
kermos at somrek.net
Tue Dec 9 22:24:37 CET 2008
I'm having a problem with exception handling under Qt.
I have a class called Exception which is thrown by my code whenever something bad enough happens to warrant throwing an exception. Generally this means a SQL query to the database failed when it shouldn't have.
In main (simplified) then looks like this:
int main(...)
{
QApplication app(...);
// Some initial startup code
try
{
// Create main window
app.exec();
}
catch(Exception ex)
{
// Handle exception
}
}
Now if I throw an exception before app.exec() is called, it is correctly handled by my exception handler.
However, any exception thrown while app.exec() is running results in only this message on the console:
"terminate called after throwing an instance of 'Exception'"
My Exception handler is never called. Does Qt have it's own exception handler and is it intercepting my exceptions? If so, how and where should I put my exception handler?
Thanks,
Stephan
More information about the Qt-interest-old
mailing list