Improve “Connection refused” error message
authorWuzzy <Wuzzy2@mail.ru>
Mon, 13 Aug 2018 16:31:22 +0200
changeset 13658 73993abb85d7
parent 13657 2d38dc2d3414
child 13659 1889e4e95794
Improve “Connection refused” error message
QTfrontend/net/newnetclient.cpp
--- a/QTfrontend/net/newnetclient.cpp	Mon Aug 13 16:01:58 2018 +0200
+++ b/QTfrontend/net/newnetclient.cpp	Mon Aug 13 16:31:22 2018 +0200
@@ -237,7 +237,12 @@
             emit disconnected(tr("The host was not found. Please check the host name and port settings."));
             break;
         case QAbstractSocket::ConnectionRefusedError:
-            emit disconnected(tr("Connection refused"));
+            if (getHost() == (QString("%1:%2").arg(NETGAME_DEFAULT_SERVER).arg(NETGAME_DEFAULT_PORT)))
+                // Error for official server
+                emit disconnected(tr("The connection was refused by the official server or timed out. Something seems to be wrong with the official server at the moment. This might be a temporary problem. Please try again later."));
+            else
+                // Error for every other host
+                emit disconnected(tr("The connection was refused by the host or timed out. This might have one of the following reasons:\n- The Hedgewars Server program does currently not run on the host\n- The specified port number is incorrect\n- There is a temporary network problem\n\nPlease check the host name and port settings and/or try again later."));
             break;
         default:
             emit disconnected(NetSocket.errorString());