|
Ran
|
Jobs
0
|
Files
0
|
Run time
–
|
Badge
README BADGES
|
push
github
refactor(rust): reduce ServiceError (round 1) (#2292) The Rust part of the project was introduced just as a command-line interface. However, it has turned into a full blown HTTP/API server (with a command-line) and we plan to move more code from Ruby to Rust. We are learning Rust as we go, so some old decisions might need to be revisited. I have started by trying to simplify the [ServiceError](https://github.com/agama-project/agama/blob/70e7d987c/rust/agama-lib/src/error.rs#L29-L78) enum, which represents an error but includes variants for many different situation (even unrelated ones). We even have an "anyhow" variant! This first round includes: - Defining an error for each HTTP client. - Defining an error for each store. - Defining an error for the storage, which includes one variant for each store. - Remove some `ServiceError` variants. - Make use of `anyhow` in more places of the binary. Once we have put everything into a better place, we can decide to simplify the whole thing if needed. Let's go step by step. ## To do - [x] Test the changes - [ ] Convert errors with a single variant into structs (?) - [x] Adapt changes from https://github.com/agama-project/agama/pull/2270. - [x] Update the changes file ## Follow-up - There is another whole category errors that are related to D-Bus. Let's move them to their own error and finish the `ServiceError` clean-up. - The HTTP client constructors do not need to be async. - The D-Bus clients are the "special cases". Perhaps we should consider moving from DomainHTTPClient to DomainClient (and DomainClient to DomainDBusClient). > [!WARNING] > Do not merge before https://github.com/agama-project/agama/pull/2270. We need to fix some conflicts first.