Skip to content

Commit

Permalink
print logs when fetching version
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz authored and slipher committed Jan 1, 2021
1 parent c2382cd commit 5926747
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions currentversionfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,30 @@ void CurrentVersionFetcher::reply(QNetworkReply* reply)
QString game;
QString updater;
if (reply->error() != QNetworkReply::NoError) {
qDebug() << "CurrentVersionFetcher: network error";
emit onCurrentVersions(updater, game);
return;
}
QJsonParseError error;
QJsonDocument json = QJsonDocument::fromJson(reply->readAll(), &error);
if (error.error != QJsonParseError::NoError) {
qDebug() << "CurrentVersionFetcher: JSON parsing error";
emit onCurrentVersions(updater, game);
return;
}
QJsonValue value = json.object().value("updater");
if (value != QJsonValue::Undefined) {
updater = value.toString();
} else {
qDebug() << "CurrentVersionFetcher: undefined “updater” value";
}
value = json.object().value("unvanquished");
if (value != QJsonValue::Undefined) {
game = value.toString();
} else {
qDebug() << "CurrentVersionFetcher: undefined “unvanquished” value";
}
qDebug() << "CurrentVersionFetcher: fetched versions: updater =" << updater << "game =" << game;
emit onCurrentVersions(updater, game);
}

0 comments on commit 5926747

Please sign in to comment.