Browse Source

Show appropriate error message on lobby server startup failure

Ivan Savenko 1 year ago
parent
commit
536156dd92
1 changed files with 9 additions and 1 deletions
  1. 9 1
      lobby/EntryPoint.cpp

+ 9 - 1
lobby/EntryPoint.cpp

@@ -35,7 +35,15 @@ int main(int argc, const char * argv[])
 	LobbyServer server(databasePath);
 	LobbyServer server(databasePath);
 	logGlobal->info("Starting server on port %d", LISTENING_PORT);
 	logGlobal->info("Starting server on port %d", LISTENING_PORT);
 
 
-	server.start(LISTENING_PORT);
+	try
+	{
+		server.start(LISTENING_PORT);
+	}
+	catch (const boost::system::system_error & e)
+	{
+		logGlobal->error("Failed to start server! Another server already uses the same port? Reason: '%s'", e.what());
+		return 1;
+	}
 	server.run();
 	server.run();
 
 
 	return 0;
 	return 0;