mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-17 02:59:03 +01:00
Show Json parse error
This commit is contained in:
parent
fe3af3a676
commit
dfecd0cd12
@ -244,7 +244,7 @@ void GeniusLyricsProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(data, &json_error);
|
||||
|
||||
if (json_error.error != QJsonParseError::NoError) {
|
||||
AuthError("Authentication reply from server missing Json data.");
|
||||
Error(QString("Failed to parse Json data in authentication reply: %1").arg(json_error.errorString()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64
|
||||
}
|
||||
|
||||
if (!json_obj.contains("meta")) {
|
||||
Error("Json reply is missing meta.", json_obj);
|
||||
Error("Json reply is missing meta object.", json_obj);
|
||||
EndSearch(search);
|
||||
return;
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ QJsonObject JsonLyricsProvider::ExtractJsonObj(const QByteArray &data) {
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(data, &error);
|
||||
QJsonParseError json_error;
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(data, &json_error);
|
||||
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
Error(QString("Failed to parse json data: %1").arg(error.errorString()));
|
||||
if (json_error.error != QJsonParseError::NoError) {
|
||||
Error(QString("Failed to parse json data: %1").arg(json_error.errorString()));
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
|
@ -74,9 +74,7 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
||||
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data;
|
||||
QString failure_reason;
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
failure_reason = QString("%1 (%2)").arg(reply->errorString()).arg(reply->error());
|
||||
if (reply->error() < 200) {
|
||||
@ -89,7 +87,7 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
||||
failure_reason = QString("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt());
|
||||
}
|
||||
|
||||
data = reply->readAll();
|
||||
QByteArray data = reply->readAll();
|
||||
LyricsSearchResults results;
|
||||
|
||||
if (!data.isEmpty()) {
|
||||
|
@ -85,11 +85,9 @@ void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const qui
|
||||
LyricsSearchResults results;
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
if (reply->error() < 200) {
|
||||
Error(QString("%1 (%2)").arg(reply->errorString()).arg(reply->error()));
|
||||
emit SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
Error(QString("%1 (%2)").arg(reply->errorString()).arg(reply->error()));
|
||||
emit SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
else if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||
Error(QString("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()));
|
||||
|
Loading…
Reference in New Issue
Block a user