From fa8f3db1337bed4d9415d0c2722e5894727021ab Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 26 Aug 2024 17:30:06 +0200 Subject: [PATCH] Re-add Exception to Failing hierarchy It needs to be removed later, when we can break bin-compat. --- main/api/src/mill/api/Result.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/api/src/mill/api/Result.scala b/main/api/src/mill/api/Result.scala index e73f4c0caab..1d8b26bd10b 100644 --- a/main/api/src/mill/api/Result.scala +++ b/main/api/src/mill/api/Result.scala @@ -29,6 +29,7 @@ object Result { case e: ResultFailureException => // TODO: add cause when Result.Failure supports it Result.Failure(e.getMessage, None) + case f: Result.Failing[T] => f case e: Throwable => Exception(e, new OuterStack(new java.lang.Exception().getStackTrace().toIndexedSeq)) } @@ -65,11 +66,11 @@ object Result { * A failed task execution. * @tparam T The result type of the computed task. */ - sealed trait Failing[+T] extends Result[T] { + // TODO: remove `Exception` from hierarchy for Mill 0.13 + sealed trait Failing[+T] extends java.lang.Exception with Result[T] { def map[V](f: T => V): Failing[V] def flatMap[V](f: T => Result[V]): Failing[V] override def asFailing: Option[Result.Failing[T]] = Some(this) - } /**