Tidal: Show API error instead of network error when available

This commit is contained in:
Jonas Kvinge
2020-08-09 01:50:03 +02:00
parent ab7d383cf1
commit 5ec33ec821

View File

@@ -112,11 +112,13 @@ QByteArray TidalBaseRequest::GetReplyData(QNetworkReply *reply, const bool send_
error = QString("%1 (%2) (%3)").arg(user_message).arg(status).arg(sub_status); error = QString("%1 (%2) (%3)").arg(user_message).arg(status).arg(sub_status);
} }
} }
if (reply->error() != QNetworkReply::NoError) { if (error.isEmpty()) {
error = QString("%1 (%2)").arg(reply->errorString()).arg(reply->error()); if (reply->error() != QNetworkReply::NoError) {
} error = QString("%1 (%2)").arg(reply->errorString()).arg(reply->error());
else { }
error = QString("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()); else {
error = QString("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt());
}
} }
if (status == 401 && sub_status == 6001) { // User does not have a valid session if (status == 401 && sub_status == 6001) { // User does not have a valid session
emit service_->Logout(); emit service_->Logout();