mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
fix: simplify error handling in toggle_proxy_profile by logging errors directly
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::{
|
|||||||
cmd,
|
cmd,
|
||||||
config::{Config, PrfItem, PrfOption, profiles::profiles_draft_update_item_safe},
|
config::{Config, PrfItem, PrfOption, profiles::profiles_draft_update_item_safe},
|
||||||
core::{CoreManager, handle, tray},
|
core::{CoreManager, handle, tray},
|
||||||
logging,
|
logging, logging_error,
|
||||||
utils::logging::Type,
|
utils::logging::Type,
|
||||||
};
|
};
|
||||||
use anyhow::{Result, bail};
|
use anyhow::{Result, bail};
|
||||||
@@ -11,17 +11,10 @@ use tauri::Emitter;
|
|||||||
|
|
||||||
/// Toggle proxy profile
|
/// Toggle proxy profile
|
||||||
pub async fn toggle_proxy_profile(profile_index: String) {
|
pub async fn toggle_proxy_profile(profile_index: String) {
|
||||||
match cmd::patch_profiles_config_by_profile_index(profile_index).await {
|
logging_error!(
|
||||||
Ok(_) => {
|
Type::Config,
|
||||||
let result = tray::Tray::global().update_menu().await;
|
cmd::patch_profiles_config_by_profile_index(profile_index).await
|
||||||
if let Err(err) = result {
|
);
|
||||||
logging!(error, Type::Tray, "更新菜单失败: {}", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
logging!(error, Type::Tray, "{err}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn switch_proxy_node(group_name: &str, proxy_name: &str) {
|
pub async fn switch_proxy_node(group_name: &str, proxy_name: &str) {
|
||||||
|
|||||||
Reference in New Issue
Block a user