Refactoring catching exceptions.
--HG-- branch : feature
This commit is contained in:
parent
978858be50
commit
2ca2595968
|
@ -45,77 +45,33 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
e.CriticalMessageBox(tr("Error parsing file. Program will be terminated."));
|
||||||
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();
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
e.CriticalMessageBox(tr("Error bad id. Program will be terminated."));
|
||||||
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();
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
catch (const VExceptionConversionError &e)
|
catch (const VExceptionConversionError &e)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
e.CriticalMessageBox(tr("Error can't convert value. Program will be terminated."));
|
||||||
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();
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
catch (const VExceptionEmptyParameter &e)
|
catch (const VExceptionEmptyParameter &e)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
e.CriticalMessageBox(tr("Error empty parameter. Program will be terminated."));
|
||||||
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();
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
catch (const VExceptionWrongParameterId &e)
|
catch (const VExceptionWrongParameterId &e)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
e.CriticalMessageBox(tr("Error wrong id. Program will be terminated."));
|
||||||
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();
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
e.CriticalMessageBox(tr("Something's wrong!!"));
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
return true;
|
||||||
msgBox.setText(tr("Something's wrong!!"));
|
|
||||||
msgBox.setInformativeText(e.ErrorMessage());
|
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
|
||||||
msgBox.exec();
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user