1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-16 02:44:10 +02:00

print exceptions in main window

This commit is contained in:
soloturn
2022-04-25 07:23:12 +02:00
parent bc59d90579
commit 886782d4cd

View File

@@ -131,7 +131,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
model = queueListModel; model = queueListModel;
if (model.size() > 0) { if (model.size() > 0) {
Utils.setConfigList("queue", (Enumeration<Object>) model.elements()); Utils.setConfigList("queue", model.elements());
Utils.saveConfig(); Utils.saveConfig();
} }
@@ -258,6 +258,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try { try {
setupTrayIcon(); setupTrayIcon();
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
EmptyBorder emptyBorder = new EmptyBorder(5, 5, 5, 5); EmptyBorder emptyBorder = new EmptyBorder(5, 5, 5, 5);
@@ -347,6 +348,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
icon = ImageIO.read(getClass().getClassLoader().getResource("gear.png")); icon = ImageIO.read(getClass().getClassLoader().getResource("gear.png"));
optionConfiguration.setIcon(new ImageIcon(icon)); optionConfiguration.setIcon(new ImageIcon(icon));
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
gbc.gridx = 0; gbc.gridx = 0;
optionsPanel.add(optionLog, gbc); optionsPanel.add(optionLog, gbc);
@@ -539,6 +541,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
configSaveDirLabel.setForeground(Color.BLUE); configSaveDirLabel.setForeground(Color.BLUE);
configSaveDirLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); configSaveDirLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error(e);
} }
configSaveDirLabel.setToolTipText(configSaveDirLabel.getText()); configSaveDirLabel.setToolTipText(configSaveDirLabel.getText());
configSaveDirLabel.setHorizontalAlignment(JLabel.RIGHT); configSaveDirLabel.setHorizontalAlignment(JLabel.RIGHT);
@@ -614,6 +617,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
Utils.setConfigInteger(key, newValue); Utils.setConfigInteger(key, newValue);
} }
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.warn(e.getMessage());
} }
} }
}); });
@@ -821,6 +825,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try { try {
historyTableModel.fireTableDataChanged(); historyTableModel.fireTableDataChanged();
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
saveHistory(); saveHistory();
}); });
@@ -852,6 +857,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try { try {
historyTableModel.fireTableDataChanged(); historyTableModel.fireTableDataChanged();
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
saveHistory(); saveHistory();
}); });
@@ -861,6 +867,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try { try {
historyTableModel.fireTableDataChanged(); historyTableModel.fireTableDataChanged();
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
saveHistory(); saveHistory();
} }
@@ -908,6 +915,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
Desktop desktop = Desktop.getDesktop(); Desktop desktop = Desktop.getDesktop();
desktop.open(file.toFile()); desktop.open(file.toFile());
} catch (IOException ex) { } catch (IOException ex) {
LOGGER.warn(ex.getMessage());
} }
} }
}); });
@@ -998,6 +1006,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
} }
private void setLogLevel(String level) { private void setLogLevel(String level) {
// default level is error, set in case something else is given.
Level newLevel = Level.ERROR; Level newLevel = Level.ERROR;
level = level.substring(level.lastIndexOf(' ') + 1); level = level.substring(level.lastIndexOf(' ') + 1);
switch (level) { switch (level) {
@@ -1009,10 +1018,6 @@ public final class MainWindow implements Runnable, RipStatusHandler {
break; break;
case "Warn": case "Warn":
newLevel = Level.WARN; newLevel = Level.WARN;
break;
case "Error":
newLevel = Level.ERROR;
break;
} }
LoggerContext ctx = (LoggerContext) LogManager.getContext(false); LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration config = ctx.getConfiguration(); Configuration config = ctx.getConfiguration();
@@ -1066,6 +1071,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
} }
about.append("</ul>"); about.append("</ul>");
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
about.append("<br>And download videos from video sites:"); about.append("<br>And download videos from video sites:");
try { try {
@@ -1082,6 +1088,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
} }
about.append("</ul>"); about.append("</ul>");
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
about.append("Do you want to visit the project homepage on Github?"); about.append("Do you want to visit the project homepage on Github?");
@@ -1130,7 +1137,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
} catch (IOException | AWTException e) { } catch (IOException | AWTException e) {
// TODO implement proper stack trace handling this is really just intented as a // TODO implement proper stack trace handling this is really just intented as a
// placeholder until you implement proper error handling // placeholder until you implement proper error handling
e.printStackTrace(); LOGGER.warn(e.getMessage());
} }
} }
@@ -1161,6 +1168,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
sd.insertString(sd.getLength(), text + "\n", sas); sd.insertString(sd.getLength(), text + "\n", sas);
} }
} catch (BadLocationException e) { } catch (BadLocationException e) {
LOGGER.warn(e.getMessage());
} }
logText.setCaretPosition(sd.getLength()); logText.setCaretPosition(sd.getLength());
@@ -1451,6 +1459,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try { try {
entry.title = ripper.getAlbumTitle(ripper.getURL()); entry.title = ripper.getAlbumTitle(ripper.getURL());
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
LOGGER.warn(e.getMessage());
} }
HISTORY.add(entry); HISTORY.add(entry);
historyTableModel.fireTableDataChanged(); historyTableModel.fireTableDataChanged();
@@ -1471,6 +1480,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
Image folderIcon = ImageIO.read(getClass().getClassLoader().getResource("folder.png")); Image folderIcon = ImageIO.read(getClass().getClassLoader().getResource("folder.png"));
openButton.setIcon(new ImageIcon(folderIcon)); openButton.setIcon(new ImageIcon(folderIcon));
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage());
} }
/* /*
* content key %path% the path to the album folder %url% is the album url * content key %path% the path to the album folder %url% is the album url