-
-
Notifications
You must be signed in to change notification settings - Fork 404
Split out Result
and ExecResult
types, replace Either[String, T]
with Result
#4528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ae6a90f
to
e700b3a
Compare
ae0f728
to
fdf996f
Compare
5a1b8b7
to
597a0aa
Compare
val outerStack = new mill.api.Result.OuterStack(base.getStackTrace) | ||
Left(mill.api.Result.Exception(e, outerStack).toString) | ||
} | ||
class Exception(val error: String) extends java.lang.Exception(error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some ScalaDoc would be nice. What's the purpose of and when to use this exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is meant to replace the Result.Failure extends Exception
we wanted to get rid of. I'll add Scaladoc later, I expect this to evolve significantly
// val (doneMsg, testResults) = res | ||
// testResults | ||
// .groupBy(_.fullyQualifiedName) | ||
// .view | ||
// .mapValues(_.map(e => e.selector -> e).toMap) | ||
// .toMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and some other tests were commented out. We should revisit this.
Fixes #4527
Result
should hopefully provide a simple user-facing result type, replacing the extensive use ofEither[String, T]
throughout the codebase.ExecResult
models the internals of theexec/
module and really shouldn't be used elsewhere.Exactly how rich to make the
Result
type is uncertain; this PR'sEither[String, T]
version is easy and simple, but it's arguable whether we wantEither[Err, T]
to be able to hold non-string errors, orEither[List[String], T]
to be able to aggregate multiple errors (which we currently discard and pick the first one most of the time). But such changes can happen in future PRs any time before 0.13.0 is releasedFor now I just got rid of
ExecResult.Failure#value: Option[T]
. We weren't using it anywhere but in unit tests, and it wasn't really suitable to downstream use by users AFAICT. We probably need to come up with a different way to e.g. gather data from failing test results, but this one probably was a failed experiment