cleanup: rename fail_oom_clierror; surface geocode update-check error cause#3806
Merged
Conversation
- Rename `fail_OOM_clierror!` to `fail_oom_clierror!` so the macro name matches the snake_case convention used by its siblings (`fail_clierror!`, `fail_incorrectusage_clierror!`, `fail_encoding_clierror!`). Updates the sole call site in `src/util.rs::mem_file_check`. - In `src/cmd/geocode.rs`, the two `updater.has_updates(...)` calls used `.map_err(|_| ...)` and reported a generic "Geonames update check failed." message, discarding the underlying reqwest error. Capture the error and include its message (timeout / DNS / HTTP status / etc.) so the failure cause is visible to the user and in logs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs a small cleanup to improve consistency and debuggability in qsv’s CLI: it standardizes an out-of-memory helper macro name to snake_case, and it preserves the underlying reqwest error when geocode checks Geonames for index updates.
Changes:
- Renamed
fail_OOM_clierror!→fail_oom_clierror!and updated themem_file_checkcall site. - Updated
geocode’sIndexUpdater::has_updateserror mapping to include the underlying network error message.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/util.rs | Updates the OOM macro call in mem_file_check to the new snake_case name. |
| src/cmd/geocode.rs | Preserves and surfaces the underlying update-check error cause in index-check and index-update. |
| src/clitypes.rs | Renames the OOM error macro for naming consistency with other fail_*_clierror! helpers. |
Comments suppressed due to low confidence (1)
src/clitypes.rs:113
- The doc comment says this macro writes to stderr, but the implementation only logs via
log::errorand returnsErr(CliError::OutOfMemory(..)). Consider updating the comment to avoid misleading future readers (or adjust the macro to actually emit to stderr if that’s intended).
/// write to stderr and log::error, using CliError::OutOfMemory
macro_rules! fail_oom_clierror {
($($t:tt)*) => {{
use log::error;
use crate::CliError;
let err = format!($($t)*);
error!("{err}");
Err(CliError::OutOfMemory(err))
}};
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.
Summary
fail_OOM_clierror!tofail_oom_clierror!for snake_case consistency with the otherfail_*_clierror!macros (fail_clierror!,fail_incorrectusage_clierror!,fail_encoding_clierror!). One call site updated insrc/util.rs::mem_file_check.src/cmd/geocode.rs, the twoupdater.has_updates(...).await.map_err(|_| ...)sites discarded the reqwest error and reported a generic "Geonames update check failed." Capture the error and include its message so timeouts, DNS failures, HTTP errors, etc. are visible to the user and in logs.Both findings came out of a
/symbolic-reviewofsrc/clitypes.rs.Test plan
cargo build --locked --bin qsv -F all_features— cleancargo build --locked --bin qsvlite -F lite— clean (pre-existing warnings only)cargo build --locked --bin qsvdp -F datapusher_plus— clean (pre-existing warnings only)cargo clippy --locked -F all_features --bin qsv— cleanqsv geocode index-check/index-updateagainst an unreachable Geonames host to confirm the reqwest cause now appears in the error message🤖 Generated with Claude Code