Display error message in GUI when subtitles cannot be written to disk (e.g. permission issues)

This commit is contained in:
Reinhard Pointner 2016-07-09 21:17:59 +08:00
parent e0c461da76
commit 2264761bf5
1 changed files with 6 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.AbstractList;
import java.util.ArrayList;
@ -445,7 +446,7 @@ class SubtitleAutoMatchDialog extends JDialog {
setIcon(subtitleBean.getIcon());
setToolTipText(null);
} else {
setText(String.format("%s (%s)", subtitleBean.getText(), subtitleBean.getError().getMessage()));
setText(String.format("%s (%s)", subtitleBean.getError().getMessage(), subtitleBean.getText()));
setIcon(ResourceManager.getIcon("status.warning"));
setToolTipText(subtitleBean.getError().toString());
}
@ -832,6 +833,10 @@ class SubtitleAutoMatchDialog extends JDialog {
return destination;
} catch (Exception e) {
// display error message in GUI
descriptor.error = new IOException("Failed to write file: " + e.getMessage());
// print to error log
debug.log(Level.WARNING, e.getMessage(), e);
}