wasefire
wasefire copied to clipboard
Simplify try-blocks in scheduler for API call replies
trafficstars
A scheduler reply currently looks like Result<Result<T, Error>, Trap> which does not work nicely with try-blocks that only support one level of Result. This is problematic when within the same try-block some functions may return Error while others may return Trap. We can only use the ? syntax for Trap. By introducing the following type:
enum Failure {
Trap(Trap),
Error(Error),
}
impl From<Trap> for Failure { ... }
impl From<Error> for Failure { ... }
It will be possible to use ? for both Trap and Error. We also need to change the schedule reply signature to take Result<T, Failure> instead.
This issue is part of #43.