From a36a254c3edbac394449bb7c9e01e2f93111ee30 Mon Sep 17 00:00:00 2001 From: James Procter Date: Thu, 7 Sep 2023 16:26:40 +0100 Subject: [PATCH] =?utf8?q?JAL-4279=20catch=20exceptions=20with=20fileLoader=20?= =?utf8?q?and=20report=20when=20we=20don=E2=80=99t=20get=20an=20alignment=20?= =?utf8?q?frame=20after=20trying=20to=20import=20a=20given=20file=20before=20?= =?utf8?q?moving=20on.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/bin/Commands.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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, -- 1.7.10.2