Refactor spawn_blocking error propagation - #421
Merged
Merged
Conversation
- Removed redundant `.context("Failed to join blocking task")` wrappers in `load_async` and `update_service_async` within `config.rs` and `users.rs`, favoring idiomatic `.await?` for exact `JoinError` propagation.
- Replaced silent `.unwrap_or(false)` and `.unwrap_or(tuple)` with `.unwrap_or_else` in `users.rs` password verification and `web.rs` telemetry to explicitly log `JoinError`s.
- Refactored six axum handlers in `web.rs` (`add_user`, `update_user_role_and_quota`, `delete_user`, `install_user_app`, `uninstall_user_app`, `update_password`) to replace verbose error swallowing `match` blocks with `.unwrap_or_else` capturing the `JoinError` contextually into the `anyhow` chain, preventing silent loss of source failures.
- Zero behavior changes outside error preservation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.context("Failed to join blocking task")wrappers inload_asyncandupdate_service_asyncwithinconfig.rsandusers.rs, favoring idiomatic.await?for exactJoinErrorpropagation..unwrap_or(false)and.unwrap_or(tuple)with.unwrap_or_elseinusers.rspassword verification andweb.rstelemetry to explicitly logJoinErrors.web.rs(add_user,update_user_role_and_quota,delete_user,install_user_app,uninstall_user_app,update_password) to replace verbose error swallowingmatchblocks with.unwrap_or_elsecapturing theJoinErrorcontextually into theanyhowchain, preventing silent loss of source failures.