Show a more informative error message for BindException. (fixes #119)

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-08-12 21:46:10 -05:00
parent f22498ae7d
commit 7dc5f973de
2 changed files with 7 additions and 1 deletions

View File

@ -62,6 +62,7 @@ public class ErrorHandler {
textArea.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
textArea.setTabSize(2);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
}
/** Scroll pane holding JTextArea. */

View File

@ -118,7 +118,12 @@ public class Opsu extends StateBasedGame {
try {
SERVER_SOCKET = new ServerSocket(Options.getPort());
} catch (IOException e) {
ErrorHandler.error(String.format("Another program is already running on port %d.", Options.getPort()), e, false);
ErrorHandler.error(String.format(
"opsu! could not be launched for one of these reasons:\n" +
"- An instance of opsu! is already running.\n" +
"- Another program is running on port %d. " +
"You can change the port opsu! uses by editing the \"Port\" field in the configuration file.",
Options.getPort()), null, false);
System.exit(1);
}