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
This commit is contained in:
kshakir 2011-02-18 22:21:15 +00:00
parent d97ed3e080
commit 290afae047
2 changed files with 13 additions and 1 deletions

View File

@ -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);
}
}
}

View File

@ -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")
}