Refactoring catching exceptions.

--HG--
branch : feature
This commit is contained in:
dismine 2014-03-03 17:42:14 +02:00
parent 978858be50
commit 2ca2595968

View File

@ -45,77 +45,33 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
}
catch (const VExceptionObjectError &e)
{
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Error parsing file. Program will be terminated."));
msgBox.setInformativeText(e.ErrorMessage());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setDetailedText(e.DetailedInformation());
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
e.CriticalMessageBox(tr("Error parsing file. Program will be terminated."));
abort();
}
catch (const VExceptionBadId &e)
{
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Error bad id. Program will be terminated."));
msgBox.setInformativeText(e.ErrorMessage());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
e.CriticalMessageBox(tr("Error bad id. Program will be terminated."));
abort();
}
catch (const VExceptionConversionError &e)
{
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Error can't convert value. Program will be terminated."));
msgBox.setInformativeText(e.ErrorMessage());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
e.CriticalMessageBox(tr("Error can't convert value. Program will be terminated."));
abort();
}
catch (const VExceptionEmptyParameter &e)
{
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Error empty parameter. Program will be terminated."));
msgBox.setInformativeText(e.ErrorMessage());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setDetailedText(e.DetailedInformation());
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
e.CriticalMessageBox(tr("Error empty parameter. Program will be terminated."));
abort();
}
catch (const VExceptionWrongParameterId &e)
{
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Error wrong id. Program will be terminated."));
msgBox.setInformativeText(e.ErrorMessage());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setDetailedText(e.DetailedInformation());
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
e.CriticalMessageBox(tr("Error wrong id. Program will be terminated."));
abort();
}
catch (const VException &e)
{
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Something's wrong!!"));
msgBox.setInformativeText(e.ErrorMessage());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
e.CriticalMessageBox(tr("Something's wrong!!"));
return true;
}
catch (std::exception& e)
{