fix(cmd): service error message return with shorter message

This commit is contained in:
Tunglies 2025-03-28 11:35:50 +08:00
parent 4a47c5bb6f
commit 1c046f3ca3

View File

@ -9,14 +9,14 @@ async fn execute_service_operation(
service_op: impl std::future::Future<Output = Result<(), impl ToString + std::fmt::Debug>>, service_op: impl std::future::Future<Output = Result<(), impl ToString + std::fmt::Debug>>,
op_type: &str, op_type: &str,
) -> CmdResult { ) -> CmdResult {
if let Err(e) = service_op.await { if let Err(_) = service_op.await {
let emsg = format!("{} {} failed: {:?}", op_type, "service", e); let emsg = format!("{} {} failed", op_type, "service");
logging_error!(Type::Service, true, "{}", emsg); // logging_error!(Type::Service, true, "{:?}", e);
return Err(emsg); return Err(emsg);
} }
if let Err(e) = CoreManager::global().restart_core().await { if let Err(_) = CoreManager::global().restart_core().await {
let emsg = format!("{} {} failed: {:?}", op_type, "core", e); let emsg = format!("{} {} failed", op_type, "core");
logging_error!(Type::Core, true, "{}", emsg); // logging_error!(Type::Core, true, "{:?}", e);
return Err(emsg); return Err(emsg);
} }
Ok(()) Ok(())