Skip to content

Commit

Permalink
fix(updater): fix updater stopping the application when no asset is f…
Browse files Browse the repository at this point in the history
…ound.
  • Loading branch information
ja-ko committed Jun 2, 2024
1 parent 8055ca5 commit 6d87f68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::path::PathBuf;

use filetime::FileTime;
use glob::glob;
use log::{debug, error, info, LevelFilter};
use log::{debug, error, info, LevelFilter, warn};
use ratatui::backend::CrosstermBackend;
use ratatui::Terminal;
use regex::Regex;
use self_update::{cargo_crate_version, Status};
use self_update::{Status};

use crate::app::{App, AppResult};
use crate::config::{get_config, get_logdir};
Expand Down Expand Up @@ -80,10 +80,15 @@ fn main() -> AppResult<()> {
}
Ok(UpdateResult::UpToDate) => {}
Err(e) => {
error!("Failed to update the application. {}", e);
tui_logger::move_events();
println!("Failed to update the application.");
return Err(e.into());
if matches!(e, UpdateError::NoCompatibleAssetFound) {
warn!("Current release has no asset for current target.");
tui_logger::move_events();
} else {
error!("Failed to update the application. {}", e);
tui_logger::move_events();
println!("Failed to update the application.");
return Err(e.into());
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use log::{debug, error, info};
use self_update::{cargo_crate_version, Extract, self_replace};
use semver::Version;
use snafu::Snafu;
use crate::app::AppResult;

#[derive(Debug, PartialEq)]
pub enum UpdateResult {
UpToDate,
Updated,
Expand Down

0 comments on commit 6d87f68

Please sign in to comment.