diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 91b53e59..e4417c54 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -1053,6 +1053,12 @@ public final class MainWindow implements Runnable, RipStatusHandler { } } + /** + * Write a line to the Log section of the GUI + * + * @param text the string to log + * @param color the color of the line + */ private void appendLog(final String text, final Color color) { SimpleAttributeSet sas = new SimpleAttributeSet(); StyleConstants.setForeground(sas, color); @@ -1066,6 +1072,17 @@ public final class MainWindow implements Runnable, RipStatusHandler { logText.setCaretPosition(sd.getLength()); } + /** + * Write a line to the GUI log and the CLI log + * + * @param line the string to log + * @param color the color of the line for the GUI log + */ + public void displayAndLogError(String line, Color color) { + appendLog(line, color); + LOGGER.error(line); + } + private void loadHistory() { File historyFile = new File(Utils.getConfigDir() + File.separator + "history.json"); HISTORY.clear(); @@ -1213,7 +1230,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { urlText = "http://" + urlText; } URL url = new URL(urlText); - // Ripper is needed here to throw.not throw an Exception + // Ripper is needed here to throw/not throw an Exception AbstractRipper ripper = AbstractRipper.getRipper(url); return true; } catch (Exception e) { @@ -1238,8 +1255,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { queueListModel.add(queueListModel.size(), realURL); ripTextfield.setText(""); } else { - appendLog("Can't find ripper for " + realURL, Color.RED); - LOGGER.error("Can't find ripper for " + realURL); + displayAndLogError("Can't find ripper for " + realURL, Color.RED); } } }