fix: implement proper error handling for "Restart App" failures (#4951)

* fix: implement proper error handling for "Restart App" failures

* fix: make clippy happy
This commit is contained in:
Sline
2025-10-07 07:32:01 +08:00
committed by GitHub
parent b20b30baad
commit a7fa63f054
2 changed files with 22 additions and 11 deletions

View File

@@ -103,16 +103,12 @@ pub fn resolve_setup_async() {
}
// 其它辅助函数不变
pub async fn resolve_reset_async() {
pub async fn resolve_reset_async() -> Result<(), anyhow::Error> {
logging!(info, Type::Tray, true, "Resetting system proxy");
logging_error!(
Type::System,
true,
sysopt::Sysopt::global().reset_sysproxy().await
);
sysopt::Sysopt::global().reset_sysproxy().await?;
logging!(info, Type::Core, true, "Stopping core service");
logging_error!(Type::Core, true, CoreManager::global().stop_core().await);
CoreManager::global().stop_core().await?;
#[cfg(target_os = "macos")]
{
@@ -121,6 +117,8 @@ pub async fn resolve_reset_async() {
logging!(info, Type::System, true, "Restoring system DNS settings");
restore_public_dns().await;
}
Ok(())
}
pub fn init_handle(app_handle: AppHandle) {