From f6c279f6f2c6ab2b11d1b48cfe418be2ff3a49ff Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Wed, 28 Feb 2018 22:07:53 +0200 Subject: Propagate errors during /login & /versions --- src/MatrixClient.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/MatrixClient.cc') diff --git a/src/MatrixClient.cc b/src/MatrixClient.cc index b5c4900b..bcf7a62b 100644 --- a/src/MatrixClient.cc +++ b/src/MatrixClient.cc @@ -123,6 +123,11 @@ MatrixClient::login(const QString &username, const QString &password) noexcept int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (reply->error()) { + emit loginError(reply->errorString()); + return; + } + if (status_code == 403) { emit loginError(tr("Wrong username or password")); return; @@ -428,6 +433,11 @@ MatrixClient::versions() noexcept int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (reply->error()) { + emit versionError(reply->errorString()); + return; + } + if (status_code == 404) { emit versionError("Versions endpoint was not found on the server. Possibly " "not a Matrix server"); -- cgit 1.5.1