From aaa75b59888f898d5af2905ce0477cf77c7d2401 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 9 Mar 2016 05:58:47 +0000 Subject: [PATCH] Show expected exceptions as info message --- source/net/filebot/ui/rename/FormatDialog.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/net/filebot/ui/rename/FormatDialog.java b/source/net/filebot/ui/rename/FormatDialog.java index 8519ff3f..439a1833 100644 --- a/source/net/filebot/ui/rename/FormatDialog.java +++ b/source/net/filebot/ui/rename/FormatDialog.java @@ -545,12 +545,19 @@ public class FormatDialog extends JDialog { } catch (Exception e) { BindingException issue = findCause(e, BindingException.class); if (issue != null && getMessage(issue).contains(MediaBindingBean.EXCEPTION_SAMPLE_FILE_NOT_SET)) { + // exception caused by file bindings because sample file has not been set status.setText(getMessage(issue)); status.setIcon(ResourceManager.getIcon("action.variables")); } else if (issue != null) { + // default binding exception handler status.setText(getMessage(issue)); status.setIcon(ResourceManager.getIcon("status.info")); + } else if (e.getCause() != null && e.getCause().getClass().equals(Exception.class)) { + // ScriptShellMethods throws Exception type exceptions which are not unexpected + status.setText(e.getCause().getMessage()); + status.setIcon(ResourceManager.getIcon("status.info")); } else { + // default exception handler status.setText(String.format("%s: %s", e.getClass().getSimpleName(), e.getMessage())); status.setIcon(ResourceManager.getIcon("status.warning")); }