1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

* Display BindingException class error messages as "info" type messages instead of "warning" type, so users will understand that these messages are to be expected for some formats in some cases, and can be safely ignored

This commit is contained in:
Reinhard Pointner 2015-11-04 05:41:50 +00:00
parent 6238500d29
commit bd5a5a6fc6
4 changed files with 11 additions and 7 deletions

View File

@ -11,7 +11,7 @@ public class BindingException extends RuntimeException {
} }
public BindingException(String binding, String innerMessage, Throwable cause) { public BindingException(String binding, String innerMessage, Throwable cause) {
this(String.format("BindingException: \"%s\": %s", binding, innerMessage), cause); this(String.format("Binding \"%s\": %s", binding, innerMessage), cause);
} }
} }

View File

@ -862,10 +862,10 @@ public class MediaBindingBean {
return mediaFile; return mediaFile;
} }
private void checkMediaFile() throws RuntimeException { private void checkMediaFile() {
// make sure file is not null, and that it is an existing file // make sure file is not null, and that it is an existing file
if (mediaFile == null) { if (mediaFile == null) {
throw new RuntimeException("Path to media file not set. Click (x)= and select a sample file."); throw new IllegalStateException("Path to media file not set. Click (x)= and select a sample file.");
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -63,7 +63,6 @@ import javax.swing.text.BadLocationException;
import net.filebot.ResourceManager; import net.filebot.ResourceManager;
import net.filebot.Settings; import net.filebot.Settings;
import net.filebot.UserFiles; import net.filebot.UserFiles;
import net.filebot.WebServices;
import net.filebot.format.BindingException; import net.filebot.format.BindingException;
import net.filebot.format.ExpressionFormat; import net.filebot.format.ExpressionFormat;
import net.filebot.format.MediaBindingBean; import net.filebot.format.MediaBindingBean;
@ -544,9 +543,14 @@ public class FormatDialog extends JDialog {
} catch (CancellationException e) { } catch (CancellationException e) {
// ignore, cancelled tasks are obsolete anyway // ignore, cancelled tasks are obsolete anyway
} catch (Exception e) { } catch (Exception e) {
BindingException bindingException = findCause(e, BindingException.class); BindingException issue = findCause(e, BindingException.class);
status.setText(bindingException != null ? getMessage(bindingException) : String.format("%s: %s", e.getClass().getSimpleName(), e.getMessage())); if (issue != null) {
status.setIcon(ResourceManager.getIcon("status.warning")); status.setText(getMessage(issue));
status.setIcon(ResourceManager.getIcon("status.info"));
} else {
status.setText(String.format("%s: %s", e.getClass().getSimpleName(), e.getMessage()));
status.setIcon(ResourceManager.getIcon("status.warning"));
}
status.setVisible(true); status.setVisible(true);
} finally { } finally {
preview.setVisible(preview.getText().trim().length() > 0); preview.setVisible(preview.getText().trim().length() > 0);