From 420bd7154cd8142cf675124e49c90f8e77991d2f Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Mon, 19 Aug 2024 15:54:59 +0200 Subject: [PATCH] Print pretty error message when Result.Failure is thrown (#3391) The new `.getOrThrow` API allows to short-circuit the result of a `Result`. This prints a correct error message when `Result.Failure` is thrown in a method returning `T`, instead of returned via a method returning `Result[T]`. Pull Request: https://github.com/com-lihaoyi/mill/pull/3391 --- main/eval/src/mill/eval/Evaluator.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/eval/src/mill/eval/Evaluator.scala b/main/eval/src/mill/eval/Evaluator.scala index 8df7678817a..8cca2df3e87 100644 --- a/main/eval/src/mill/eval/Evaluator.scala +++ b/main/eval/src/mill/eval/Evaluator.scala @@ -79,8 +79,9 @@ object Evaluator { (for ((k, fs) <- evaluated.failing.items()) yield { val fss = fs.map { - case ex: Result.Exception => ex.toString case Result.Failure(t, _) => t + case Result.Exception(Result.Failure(t, _), _) => t + case ex: Result.Exception => ex.toString } s"${k.render} ${fss.iterator.mkString(", ")}" }).mkString("\n")