Unify and simplify the error handling#4718
Conversation
b1ddd1d to
42fdd3b
Compare
…eption instead of inspecting the scheduler state. Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
42fdd3b to
7266e18
Compare
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
to unify the two sides. Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
7266e18 to
a206c8e
Compare
|
@rgrinberg, I borrowed ideas from #4716, but going somewhat further and doing some clean-up of the |
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
|
Well, my version of |
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
|
Looks good. Could you also implement sending |
|
@rgrinberg, as I said on that PR, I don't understand why that change is necessary or why it's implemented that way. |
| match exn.exn with | ||
| | Scheduler.Run.Build_cancelled -> true | ||
| | Memo.Error.E err -> ( | ||
| match Memo.Error.get err with |
There was a problem hiding this comment.
To avoid dealing with the optional wrapping, we could change Memo as follow:
- make
handle_error_no_raisetake aMemo.Error.tand a backtrace rather than anExn_with_backtrace.t - make
Memo.Build.run*only raiseMemo.Error.E
There was a problem hiding this comment.
I think it is already the case that the top-level Memo.Build.run* only ever raise Memo.Error.E. We could probably make them return it instead of raising it, even.
For the first bullet-point, agreed. I was even thinking of including the backtrace into Memo.Error.t, but that's a separate idea.
(I'm assuming you're saying these as ideas for the future PRs, so I'm merging this one)
ghost
left a comment
There was a problem hiding this comment.
The changes look correct to me and the resulting code looks simpler.
|
@rgrinberg, I'm merging it because I want it to simplify the other PR. I hope it doesn't break the RPC. |
This PR does the following:
report_errorcallbacks whose purpose was to check if we're being cancelled.Scheduler.polltoBuild_system.runso that we don't have to keep synchronizing the two modules on how they handle errors.Build_system.run, not by the top-level handler in bin/main.ml, which seems like a good unification.Signed-off-by: Arseniy Alekseyev aalekseyev@janestreet.com