wasefire icon indicating copy to clipboard operation
wasefire copied to clipboard

Simplify try-blocks in scheduler for API call replies

Open ia0 opened this issue 1 year ago • 0 comments
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.

ia0 avatar May 10 '24 11:05 ia0