1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 20:34:39 +01:00

Added more verbosity to GUI error message for common network issues when

connecting to a Subsonic server.
This commit is contained in:
Ross Wolfson 2013-05-07 22:33:45 -04:00 committed by Ross
parent 25d92f5083
commit 7e32cfc358
3 changed files with 41 additions and 1 deletions

View File

@ -244,7 +244,23 @@ void SubsonicService::OnPingFinished(QNetworkReply* reply) {
reply->deleteLater();
if (reply->error() != QNetworkReply::NoError) {
login_state_ = LoginState_BadServer;
switch(reply->error()) {
case QNetworkReply::ConnectionRefusedError:
login_state_ = LoginState_ConnectionRefused;
break;
case QNetworkReply::HostNotFoundError:
login_state_ = LoginState_HostNotFound;
break;
case QNetworkReply::TimeoutError:
login_state_ = LoginState_Timeout;
break;
case QNetworkReply::SslHandshakeFailedError:
login_state_ = LoginState_SslError;
break;
default: //Treat uncaught error types here as generic
login_state_ = LoginState_BadServer;
break;
}
qLog(Error) << "Failed to connect ("
<< Utilities::EnumToString(QNetworkReply::staticMetaObject, "NetworkError", reply->error())
<< "):" << reply->errorString();

View File

@ -33,6 +33,10 @@ class SubsonicService : public InternetService
LoginState_Unlicensed,
LoginState_OtherError,
LoginState_Unknown,
LoginState_ConnectionRefused,
LoginState_HostNotFound,
LoginState_Timeout,
LoginState_SslError,
};
enum ApiError {

View File

@ -103,6 +103,26 @@ void SubsonicSettingsPage::LoginStateChanged(SubsonicService::LoginState newstat
ui_->login_state->SetAccountTypeText(tr("An unspecified error occurred."));
break;
case SubsonicService::LoginState_ConnectionRefused:
ui_->login_state->SetAccountTypeText(tr("Connection refused by server, check server URL. "
"Example: http://localhost:4040/"));
break;
case SubsonicService::LoginState_HostNotFound:
ui_->login_state->SetAccountTypeText(tr("Host not found, check server URL. "
"Example: http://localhost:4040/"));
break;
case SubsonicService::LoginState_Timeout:
ui_->login_state->SetAccountTypeText(tr("Connection timed out, check server URL. "
"Example: http://localhost:4040/"));
break;
case SubsonicService::LoginState_SslError:
ui_->login_state->SetAccountTypeText(tr("SSL handshake error, verify server configuration. "
"SSLv3 option below may workaround some issues."));
break;
default:
break;
}