Skip to content

Commit

Permalink
fix(friendshipper): report startup errors to frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
rudoi committed Oct 16, 2024
1 parent b25f789 commit 8e5b02e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 11 additions & 1 deletion friendshipper/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,21 @@ fn main() -> Result<(), CoreError> {
);

match server
.run(config, config_file, startup_tx, refresh_tx, shutdown_rx)
.run(
config,
config_file,
startup_tx.clone(),
refresh_tx,
shutdown_rx,
)
.await
{
Ok(_) => {}
Err(e) => {
startup_tx
.send("Warning: Server failed to start".to_string())
.unwrap();
git_tx.send(e.to_string()).unwrap();
error!("Server error: {:?}", e);
}
}
Expand Down
8 changes: 7 additions & 1 deletion friendshipper/src-tauri/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,13 @@ impl Server {

startup_tx.send("Performing git repo maintenance".to_string())?;
git.expire_reflog().await?;
git.run_gc().await?;
match git.run_gc().await {
Ok(_) => {}
Err(e) => {
error!("Failed to run git gc: {:?}", e);
startup_tx.send("Warning: Git maintenance failed".to_string())?;
}
}

startup_tx.send("Installing git hooks".to_string())?;
if let Some(git_hooks_path) = git_hooks_path {
Expand Down

0 comments on commit 8e5b02e

Please sign in to comment.