From 528fb775c12d6c7554c35b00524af7b9489b27fd Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Wed, 6 Mar 2019 18:33:40 -0600 Subject: [PATCH] Improve reporting of errors * Don't throw exceptions that no one is going to catch * Don't call finished() after error() is called --- src/github.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/github.cpp b/src/github.cpp index 85f1e64..4215c66 100644 --- a/src/github.cpp +++ b/src/github.cpp @@ -28,9 +28,6 @@ QJsonArray GitHub::releases(const Repository &repo) QString("repos/%1/%2/releases").arg(repo.owner, repo.project), QByteArray(), true); - if (!result.isArray()) { - throw GitHubException(result.object()); - } return result.array(); } @@ -40,9 +37,6 @@ void GitHub::releases(const Repository &repo, request(Method::GET, QString("repos/%1/%2/releases").arg(repo.owner, repo.project), QByteArray(), [callback](const QJsonDocument &result) { - if (!result.isArray()) { - throw GitHubException(result.object()); - } callback(result.array()); }, true); } @@ -144,6 +138,7 @@ void GitHub::request(Method method, const QString &path, const QByteArray &data, [reply, timer, callback](QNetworkReply::NetworkError error) { qDebug("network error %d", error); timer->stop(); + reply->disconnect(); callback(QJsonDocument( QJsonObject({{"network_error", reply->errorString()}}))); reply->deleteLater();