Issue #77 Break cyclic dependency statusmessage <-> jsonexception

This commit is contained in:
Mat Sutcliffe
2020-08-27 13:20:34 +01:00
parent 9e0ebef5a1
commit 89659fdeaa
14 changed files with 30 additions and 40 deletions

View File

@@ -116,7 +116,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit dataRead(CEntityFlags::AirportEntity, CEntityFlags::ReadFailed, 0, url);
return ex.toStatusMessage(this, QStringLiteral("Reading airports from '%1'").arg(fileName));
return CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading airports from '%1'").arg(fileName));
}
}
}

View File

@@ -544,7 +544,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit this->dataRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFailed, 0, url);
msgs.push_back(ex.toStatusMessage(this, QStringLiteral("Reading countries from '%1'").arg(fileName)));
msgs.push_back(CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading countries from '%1'").arg(fileName)));
}
}
}
@@ -583,7 +583,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit this->dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFailed, 0, url);
msgs.push_back(ex.toStatusMessage(this, QStringLiteral("Reading aircraft ICAOs from '%1'").arg(fileName)));
msgs.push_back(CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading aircraft ICAOs from '%1'").arg(fileName)));
}
}
}
@@ -622,7 +622,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit this->dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFailed, 0, url);
msgs.push_back(ex.toStatusMessage(this, QStringLiteral("Reading airline ICAOs from '%1'").arg(fileName)));
msgs.push_back(CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading airline ICAOs from '%1'").arg(fileName)));
}
}
}
@@ -661,7 +661,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit this->dataRead(CEntityFlags::AircraftCategoryEntity, CEntityFlags::ReadFailed, 0, url);
msgs.push_back(ex.toStatusMessage(this, QStringLiteral("Reading categories from '%1'").arg(fileName)));
msgs.push_back(CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading categories from '%1'").arg(fileName)));
}
}
}

View File

@@ -493,7 +493,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit this->dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFailed, 0, url);
msgs.push_back(ex.toStatusMessage(this, QStringLiteral("Reading liveries from '%1'").arg(fileName)));
msgs.push_back(CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading liveries from '%1'").arg(fileName)));
}
}
}
@@ -533,7 +533,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit this->dataRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFailed, 0, url);
msgs.push_back(ex.toStatusMessage(this, QStringLiteral("Reading models from '%1'").arg(fileName)));
msgs.push_back(CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading models from '%1'").arg(fileName)));
}
}
}
@@ -573,7 +573,7 @@ namespace BlackCore
catch (const CJsonException &ex)
{
emit this->dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFailed, 0, url);
msgs.push_back(ex.toStatusMessage(this, QStringLiteral("Reading distributors from '%1'").arg(fileName)));
msgs.push_back(CStatusMessage::fromJsonException(ex, this, QStringLiteral("Reading distributors from '%1'").arg(fileName)));
}
}
}

View File

@@ -330,7 +330,7 @@ namespace BlackCore
}
catch (const CJsonException &ex)
{
return ex.toStatusMessage(this, QStringLiteral("Parsing local setup file '%1'").arg(fn));
return CStatusMessage::fromJsonException(ex, this, QStringLiteral("Parsing local setup file '%1'").arg(fn));
}
}
@@ -408,7 +408,7 @@ namespace BlackCore
// we downloaded an unparsable JSON file.
// as we control those files something is wrong
const QString errorMsg = QStringLiteral("Setup file loaded from '%1' cannot be parsed").arg(urlString);
const CStatusMessage msg = ex.toStatusMessage(this, errorMsg);
const CStatusMessage msg = CStatusMessage::fromJsonException(ex, this, errorMsg);
CLogMessage::preformatted(msg);
emit this->setupLoadingMessages(msg);