From: James Procter Date: Thu, 7 Sep 2023 15:26:40 +0000 (+0100) Subject: JAL-4279 catch exceptions with fileLoader and report when we don’t get an alignment... X-Git-Tag: Release_2_11_4_0~184 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a36a254c3edbac394449bb7c9e01e2f93111ee30;p=jalview.git JAL-4279 catch exceptions with fileLoader and report when we don’t get an alignment frame after trying to import a given file before moving on. --- diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index b1b8288..9cacc83 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -247,9 +247,24 @@ public class Commands Console.debug( "Opening '" + openFile + "' in new alignment frame"); FileLoader fileLoader = new FileLoader(!headless); - - af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, - format); + boolean xception=false; + try { + af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, + format); + } catch (Throwable thr) + { + xception=true; + Console.error("Couldn't open '"+openFile+"' as "+format+" "+thr.getLocalizedMessage()+ " (Enable debug for full stack trace)"); + Console.debug("Exception when opening '"+openFile+"'",thr); + } + finally + { + if (af==null && !xception) + { + Console.info("Ignoring '"+openFile+"' - no alignment data found."); + continue; + } + } // colour alignment? String colour = ArgParser.getFromSubValArgOrPref(avm, av,