Skip to content

Commit 182e694

Browse files
committed
Improved error output.
* One SHA resolve, now outputs lots of stack traces if parallel execution failure.
1 parent 3ea7355 commit 182e694

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

project/ShaResolve.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Build._
44
import Keys._
55
import Project.Initialize
66
import scala.collection.{ mutable, immutable }
7-
7+
import scala.collection.parallel.CompositeThrowable
88

99

1010

@@ -22,7 +22,7 @@ object ShaResolve {
2222
pullBinaryLibs in ThisBuild <<= (baseDirectory, binaryLibCache, streams) map resolveLibs
2323
)
2424

25-
def resolveLibs(dir: File, cacheDir: File, s: TaskStreams): Unit = {
25+
def resolveLibs(dir: File, cacheDir: File, s: TaskStreams): Unit = loggingParallelExceptions(s) {
2626
val files = (dir / "test" / "files" ** "*.desired.sha1") +++ (dir / "lib" ** "*.desired.sha1")
2727
for {
2828
(file, name) <- (files x relativeTo(dir)).par
@@ -33,6 +33,13 @@ object ShaResolve {
3333
} pullFile(jar, sha + "/" + uri, cacheDir, s)
3434
}
3535

36+
@inline final def loggingParallelExceptions[U](s: TaskStreams)(f: => U): U = try f catch {
37+
case t: CompositeThrowable =>
38+
s.log.error("Error during parallel execution, GET READ FOR STACK TRACES!!")
39+
t.throwables foreach (t2 => s.log.trace(t2))
40+
throw t
41+
}
42+
3643
def getShaFromShafile(file: File): String = (IO read file split "\\s" headOption) getOrElse error("No SHA found for " + file)
3744

3845

0 commit comments

Comments
 (0)