auto_update: Show update error on hover and open logs on click (#38241)

Release Notes:

- Improved error reporting when auto-updating fails
This commit is contained in:
Lukas Wirth
2025-09-16 08:07:02 +00:00
committed by GitHub
parent 1c09985fb3
commit f321d02207
3 changed files with 32 additions and 32 deletions
+8 -6
View File
@@ -34,7 +34,7 @@ actions!(
/// Checks for available updates.
Check,
/// Dismisses the update error message.
DismissErrorMessage,
DismissMessage,
/// Opens the release notes for the current version in a browser.
ViewReleaseNotes,
]
@@ -55,14 +55,14 @@ pub enum VersionCheckType {
Semantic(SemanticVersion),
}
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone)]
pub enum AutoUpdateStatus {
Idle,
Checking,
Downloading { version: VersionCheckType },
Installing { version: VersionCheckType },
Updated { version: VersionCheckType },
Errored,
Errored { error: Arc<anyhow::Error> },
}
impl AutoUpdateStatus {
@@ -383,7 +383,9 @@ impl AutoUpdater {
}
UpdateCheckType::Manual => {
log::error!("auto-update failed: error:{:?}", error);
AutoUpdateStatus::Errored
AutoUpdateStatus::Errored {
error: Arc::new(error),
}
}
};
@@ -402,8 +404,8 @@ impl AutoUpdater {
self.status.clone()
}
pub fn dismiss_error(&mut self, cx: &mut Context<Self>) -> bool {
if self.status == AutoUpdateStatus::Idle {
pub fn dismiss(&mut self, cx: &mut Context<Self>) -> bool {
if let AutoUpdateStatus::Idle = self.status {
return false;
}
self.status = AutoUpdateStatus::Idle;