Skip to content

Commit

Permalink
cli: Suggest the user to reset the cache
Browse files Browse the repository at this point in the history
If there is an error loading a patch or issue, suggest resetting the
cache.
  • Loading branch information
cloudhead committed Aug 6, 2024
1 parent c6a8a00 commit a496190
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion radicle-cli/src/commands/issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,11 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
Operation::Show { id, format, debug } => {
let id = id.resolve(&repo.backend)?;
let issue = issues
.get(&id)?
.get(&id)
.map_err(|e| Error::WithHint {
err: e.into(),
hint: "reset the cache with `rad issue cache` and try again",
})?
.context("No issue with the given ID exists")?;
if debug {
println!("{:#?}", issue);
Expand Down
6 changes: 5 additions & 1 deletion radicle-cli/src/commands/patch/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ pub fn run(
workdir: Option<&git::raw::Repository>,
) -> anyhow::Result<()> {
let patches = profile.patches(stored)?;
let Some(patch) = patches.get(patch_id)? else {
let Some(patch) = patches.get(patch_id).map_err(|e| Error::WithHint {
err: e.into(),
hint: "reset the cache with `rad patch cache` and try again",
})?
else {
anyhow::bail!("Patch `{patch_id}` not found");
};

Expand Down

0 comments on commit a496190

Please sign in to comment.