From 7dc5f973de983c7d867fcebf9a811267e1485b6d Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Wed, 12 Aug 2015 21:46:10 -0500 Subject: [PATCH] Show a more informative error message for BindException. (fixes #119) Signed-off-by: Jeffrey Han --- src/itdelatrisu/opsu/ErrorHandler.java | 1 + src/itdelatrisu/opsu/Opsu.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/itdelatrisu/opsu/ErrorHandler.java b/src/itdelatrisu/opsu/ErrorHandler.java index 45574762..bad2c513 100644 --- a/src/itdelatrisu/opsu/ErrorHandler.java +++ b/src/itdelatrisu/opsu/ErrorHandler.java @@ -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. */ diff --git a/src/itdelatrisu/opsu/Opsu.java b/src/itdelatrisu/opsu/Opsu.java index 09e7026f..1b36b34a 100644 --- a/src/itdelatrisu/opsu/Opsu.java +++ b/src/itdelatrisu/opsu/Opsu.java @@ -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); }