Skip to content
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

Simplify try-blocks in scheduler for API call replies #463

Closed
ia0 opened this issue May 10, 2024 · 0 comments · Fixed by #465
Closed

Simplify try-blocks in scheduler for API call replies #463

ia0 opened this issue May 10, 2024 · 0 comments · Fixed by #465
Labels
crate:scheduler Modifies the platform for:maintainability Improves maintainers life needs:implementation Needs implementation to complete

Comments

@ia0
Copy link
Member

ia0 commented May 10, 2024

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 ia0 added needs:implementation Needs implementation to complete for:maintainability Improves maintainers life crate:scheduler Modifies the platform labels May 10, 2024
@ia0 ia0 changed the title Introduce a Failure error type in the scheduler Simplify try-blocks in scheduler for API call replies May 11, 2024
@ia0 ia0 linked a pull request May 24, 2024 that will close this issue
@ia0 ia0 closed this as completed in #465 May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate:scheduler Modifies the platform for:maintainability Improves maintainers life needs:implementation Needs implementation to complete
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant