From 290afae0477777b34df59e370f187d6c0426dbeb Mon Sep 17 00:00:00 2001 From: kshakir Date: Fri, 18 Feb 2011 22:21:15 +0000 Subject: [PATCH] GSA-423 Better reporting for errors in QScript.script(). git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5276 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/exceptions/UserException.java | 6 ++++++ .../src/org/broadinstitute/sting/queue/QCommandLine.scala | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java b/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java index d1c7dab4f..b4005f4dd 100755 --- a/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java +++ b/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java @@ -218,4 +218,10 @@ public class UserException extends ReviewedStingException { super(String.format("Walker %s is not available: %s", walkerName, message)); } } + + public static class CannotExecuteQScript extends UserException { + public CannotExecuteQScript(String message, Exception e) { + super(String.format("Unable to execute QScript: " + message), e); + } + } } diff --git a/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala b/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala index c99457d1b..c2ea1ec17 100755 --- a/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala +++ b/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala @@ -8,6 +8,7 @@ import org.broadinstitute.sting.queue.util._ import org.broadinstitute.sting.queue.engine.{QGraphSettings, QGraph} import collection.JavaConversions._ import org.broadinstitute.sting.utils.classloader.PluginManager +import org.broadinstitute.sting.utils.exceptions.UserException /** * Entry point of Queue. Compiles and runs QScripts passed in to the command line. @@ -43,7 +44,12 @@ class QCommandLine extends CommandLineProgram with Logging { for (script <- pluginManager.createAllTypes()) { logger.info("Scripting " + pluginManager.getName(script.getClass.asSubclass(classOf[QScript]))) loadArgumentsIntoObject(script) - script.script + try { + script.script + } catch { + case e: Exception => + throw new UserException.CannotExecuteQScript(script.getClass.getSimpleName + ".script() threw the following exception: " + e, e) + } script.functions.foreach(qGraph.add(_)) logger.info("Added " + script.functions.size + " functions") }