diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e57853..fda4998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## [Unreleased] +- Improved error message when self-update cannot find the current binary. + ## [1.47.0] - MongoDB validator now validates `mongodb+srv://` URIs with a fast timeout instead of skipping them - Improved rules: github oauth2, diffbot, mailchimp, aws diff --git a/src/update.rs b/src/update.rs index 76629be..3ab5208 100644 --- a/src/update.rs +++ b/src/update.rs @@ -129,16 +129,29 @@ pub fn check_for_update(global_args: &GlobalArgs, base_url: Option<&str>) -> Opt .apply_to(&format!("Updated to version {}", status.version())) ), Err(e) => match e { - UpdError::Io(ref io_err) if io_err.kind() == ErrorKind::PermissionDenied => { - warn!( - "{}", - styles.style_finding_active_heading.apply_to( - "Cannot replace the current binary - permission denied.\n\ - If you installed via a package manager, run its upgrade command.\n\ - Otherwise reinstall to a user-writable directory or re-run with sudo." - ) - ); - } + UpdError::Io(ref io_err) => match io_err.kind() { + ErrorKind::PermissionDenied => { + warn!( + "{}", + styles.style_finding_active_heading.apply_to( + "Cannot replace the current binary - permission denied.\n\ + If you installed via a package manager, run its upgrade command.\n\ + Otherwise reinstall to a user-writable directory or re-run with sudo." + ) + ); + } + ErrorKind::NotFound => { + warn!( + "{}", + styles.style_finding_active_heading.apply_to( + "Cannot replace the current binary - file not found.\n\ + If you installed via a package manager, run its upgrade command.\n\ + Otherwise reinstall to a user-writable directory." + ) + ); + } + _ => error!("Failed to update: {e}"), + }, _ => error!("Failed to update: {e}"), }, }