clean up scripted error handling

This commit is contained in:
Mark Harrah 2011-07-23 23:07:54 -04:00
parent 5903fb88a2
commit 960d0bc2e3
2 changed files with 7 additions and 5 deletions

View File

@ -137,7 +137,8 @@ object Sbt extends Build
val loader = classpath.ClasspathUtilities.toLoader(scriptedSbtClasspath.files, scriptedSbtInstance.loader)
val m = ModuleUtilities.getObject("sbt.test.ScriptedTests", loader)
val r = m.getClass.getMethod("run", classOf[File], classOf[Boolean], classOf[String], classOf[String], classOf[String], classOf[Array[String]], classOf[File])
r.invoke(m, sourcePath, true: java.lang.Boolean, v, sv, ssv, args.toArray[String], launcher)
try { r.invoke(m, sourcePath, true: java.lang.Boolean, v, sv, ssv, args.toArray[String], launcher) }
catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause }
}
}

View File

@ -66,10 +66,11 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, sbtVe
case e: xsbt.test.TestException =>
buffered.stop()
buffered.error("x " + label)
if(e.getCause eq null)
buffered.error(" " + e.getMessage)
else
e.printStackTrace
e.getCause match
{
case null | _: java.net.SocketException => buffered.error(" " + e.getMessage)
case _ => e.printStackTrace
}
throw e
case e: Exception =>
buffered.stop()