catch exceptions in hyperiond (#92)

This commit is contained in:
redPanther 2016-07-10 12:18:40 +02:00 committed by brindosch
parent 0feb1d7b58
commit 12cae1e634
1 changed files with 16 additions and 7 deletions

View File

@ -2,6 +2,7 @@
#include <csignal>
#include <unistd.h>
#include <sys/prctl.h>
#include <exception>
#include <QCoreApplication>
#include <QLocale>
@ -144,16 +145,24 @@ int main(int argc, char** argv)
hyperiond = new HyperionDaemon(configFiles[argvId], &app);
hyperiond->run();
}
catch (...)
catch (std::exception& e)
{
Error(log, "Hyperion Daemon aborted");
Error(log, "Hyperion Daemon aborted:\n %s", e.what());
}
WebConfig* webConfig = new WebConfig(&app);
// run the application
int rc = app.exec();
Info(log, "INFO: Application closed with code %d", rc);
int rc = 1;
WebConfig* webConfig = nullptr;
try
{
webConfig = new WebConfig(&app);
// run the application
rc = app.exec();
Info(log, "INFO: Application closed with code %d", rc);
}
catch (std::exception& e)
{
Error(log, "Hyperion aborted:\n %s", e.what());
}
// delete components
delete webConfig;