From 4a580b81568598aaa9395069c5b1ea29a1849614 Mon Sep 17 00:00:00 2001 From: fengyc Date: Thu, 24 Oct 2024 11:57:55 +0800 Subject: [PATCH] fix: convert error --- pisugar-core/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pisugar-core/src/lib.rs b/pisugar-core/src/lib.rs index aeec51f..dda5f77 100644 --- a/pisugar-core/src/lib.rs +++ b/pisugar-core/src/lib.rs @@ -693,7 +693,7 @@ impl PiSugarCore { /// Get ntp datetime. pub async fn get_ntp_datetime() -> Result> { let sntp_client = AsyncSntpClient::new(); - let result = sntp_client.synchronize(NTP_ADDR).await?; + let result = sntp_client.synchronize(NTP_ADDR).await.map_err(|e| Error::Other(format!("{}", e)))?; Ok(result.datetime().into_chrono_datetime().map_err(|e| Error::Other(format!("{}", e)))?) }