Skip to content

Commit

Permalink
Re-add Exception to Failing hierarchy
Browse files Browse the repository at this point in the history
It needs to be removed later, when we can break bin-compat.
  • Loading branch information
lefou committed Aug 26, 2024
1 parent bf86cc7 commit fa8f3db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main/api/src/mill/api/Result.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -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)

}

/**
Expand Down

0 comments on commit fa8f3db

Please sign in to comment.