Show error message if got unknown object type.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-08 09:30:26 +03:00
parent 259f1e1de0
commit a43e852977

View File

@ -355,42 +355,84 @@ void VPattern::LiteParseTree(const Document &parse)
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (VApplication::CheckGUI())
{
return; return;
} }
else
{
std::exit(V_EX_NOINPUT);
}
}
catch (const VExceptionConversionError &e) catch (const VExceptionConversionError &e)
{ {
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error can't convert value.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error can't convert value.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (VApplication::CheckGUI())
{
return; return;
} }
else
{
std::exit(V_EX_NOINPUT);
}
}
catch (const VExceptionEmptyParameter &e) catch (const VExceptionEmptyParameter &e)
{ {
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (VApplication::CheckGUI())
{
return; return;
} }
else
{
std::exit(V_EX_NOINPUT);
}
}
catch (const VExceptionWrongId &e) catch (const VExceptionWrongId &e)
{ {
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (VApplication::CheckGUI())
{
return; return;
} }
else
{
std::exit(V_EX_NOINPUT);
}
}
catch (VException &e) catch (VException &e)
{ {
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (VApplication::CheckGUI())
{
return; return;
} }
else
{
std::exit(V_EX_NOINPUT);
}
}
catch (const std::bad_alloc &) catch (const std::bad_alloc &)
{ {
qCCritical(vXML, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc)."))); qCCritical(vXML, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc).")));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (VApplication::CheckGUI())
{
return; return;
} }
else
{
std::exit(V_EX_NOINPUT);
}
}
// Restore name current pattern piece // Restore name current pattern piece
nameActivPP = namePP; nameActivPP = namePP;
@ -743,8 +785,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
ParseToolTrueDarts(scene, domElement, parse); ParseToolTrueDarts(scene, domElement, parse);
break; break;
default: default:
qDebug() << "Illegal point type in VDomDocument::ParsePointElement()."; VException e(tr("Unknown point type '%1'.").arg(type));
break; throw e;
} }
} }
@ -2102,8 +2144,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
ParseNodeSplinePath(domElement, parse); ParseNodeSplinePath(domElement, parse);
break; break;
default: default:
qCDebug(vXML, "Illegal spline type in VDomDocument::ParseSplineElement()."); VException e(tr("Unknown spline type '%1'.").arg(type));
break; throw e;
} }
} }
@ -2138,8 +2180,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
ParseToolArcWithLength(scene, domElement, parse); ParseToolArcWithLength(scene, domElement, parse);
break; break;
default: default:
qDebug() << "Illegal arc type in VDomDocument::ParseArcElement()."; VException e(tr("Unknown arc type '%1'.").arg(type));
break; throw e;
} }
} }
@ -2183,8 +2225,8 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
} }
break; break;
default: default:
qDebug() << "Illegal tools type in VDomDocument::ParseToolsElement()."; VException e(tr("Unknown tools type '%1'.").arg(type));
break; throw e;
} }
} }