1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-22 19:27:13 +01:00

see #2408 catching exceptions in FWBApplication::notify()

This commit is contained in:
Vadim Kurland 2011-05-17 10:56:16 -07:00
parent 8c4fd89855
commit 6dcf4026c6
2 changed files with 31 additions and 1 deletions

View File

@ -30,9 +30,14 @@
#include "FWBApplication.h"
#include "FWWindow.h"
#include "fwbuilder/FWException.h"
#include <QtDebug>
#include <QTimer>
using namespace libfwbuilder;
using namespace std;
void FWBApplication::quit()
{
@ -63,3 +68,25 @@ void FWBApplication::delayedQuit()
QApplication::quit();
}
bool FWBApplication::notify(QObject *receiver, QEvent *event)
{
try
{
return QApplication::notify(receiver, event);
} catch (const libfwbuilder::FWException &ex)
{
cerr << "Caught FWException: " << ex.toString() << std::endl;
QCoreApplication::exit(1);
} catch (const std::string &s) {
cerr << s << std::endl;
QCoreApplication::exit(1);
} catch (const std::exception &ex) {
cerr << ex.what() << std::endl;
QCoreApplication::exit(1);
}
catch (...) {
cerr << "Caught unsupported exception" << std::endl;
QCoreApplication::exit(1);
}
return false;
}

View File

@ -29,7 +29,8 @@
#include <QApplication>
class FWBApplication : public QApplication {
class FWBApplication : public QApplication
{
Q_OBJECT;
int timeout;
@ -37,6 +38,8 @@ class FWBApplication : public QApplication {
public:
FWBApplication(int &argc, char **argv) : QApplication(argc, argv) {}
virtual bool notify(QObject *receiver, QEvent *event);
public slots:
void quit();