mirror of https://github.com/sbt/sbt.git
show Incomplete
This commit is contained in:
parent
899920a0a0
commit
d6626e1e11
|
|
@ -9,4 +9,24 @@ final case class Incomplete(tpe: IValue = Error, message: Option[String] = None,
|
|||
|
||||
object Incomplete extends Enumeration {
|
||||
val Skipped, Error = Value
|
||||
def show(i: Incomplete, traces: Boolean): String =
|
||||
{
|
||||
val exceptions = allExceptions(i)
|
||||
val traces = exceptions.map(_.getStackTrace).mkString("\n")
|
||||
val causeStr = if(i.causes.isEmpty) "" else (i.causes.length + " cause(s)")
|
||||
"Incomplete (" + show(i.tpe) + ") " + i.message.getOrElse("") + causeStr + "\n" + traces
|
||||
}
|
||||
def allExceptions(i: Incomplete): Iterable[Throwable] =
|
||||
{
|
||||
val exceptions = IDSet.create[Throwable]
|
||||
val visited = IDSet.create[Incomplete]
|
||||
def visit(inc: Incomplete): Unit =
|
||||
visited.process(inc)( () ) {
|
||||
exceptions ++= inc.directCause.toList
|
||||
inc.causes.foreach(visit)
|
||||
}
|
||||
visit(i)
|
||||
exceptions.all
|
||||
}
|
||||
def show(tpe: Value) = tpe match { case Skipped=> "skipped"; case Error => "error" }
|
||||
}
|
||||
Loading…
Reference in New Issue