refactor(logging): replace log_err! with structured logging_error! calls

refactor(cm-service): better error handling from Backend to Frontend
This commit is contained in:
Tunglies
2025-03-28 03:39:21 +08:00
parent 59caa22431
commit e8e16f7d57
18 changed files with 232 additions and 128 deletions

View File

@@ -1,9 +1,9 @@
use crate::{
config::Config,
core::{handle, tray, CoreManager},
log_err,
logging_error,
module::mihomo::MihomoManager,
utils::resolve,
utils::{logging::Type, resolve},
};
use serde_yaml::{Mapping, Value};
use tauri::Manager;
@@ -28,7 +28,7 @@ pub fn restart_clash_core() {
pub fn restart_app() {
tauri::async_runtime::spawn_blocking(|| {
tauri::async_runtime::block_on(async {
log_err!(CoreManager::global().stop_core().await);
logging_error!(Type::Core, true, CoreManager::global().stop_core().await);
});
resolve::resolve_reset();
let app_handle = handle::Handle::global().app_handle().unwrap();
@@ -54,8 +54,8 @@ pub fn change_clash_mode(mode: String) {
if Config::clash().data().save_config().is_ok() {
handle::Handle::refresh_clash();
log_err!(tray::Tray::global().update_menu());
log_err!(tray::Tray::global().update_icon(None));
logging_error!(Type::Tray, true, tray::Tray::global().update_menu());
logging_error!(Type::Tray, true, tray::Tray::global().update_icon(None));
}
}
Err(err) => println!("{err}"),