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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user