[pdm-devel] [PATCH datacenter-manager] server: connection: improve error messages for remotes

Dominik Csapak d.csapak at proxmox.com
Fri Apr 11 16:05:57 CEST 2025


by including either the original error, or a notice that it timed out.
That way, when we return the error over the API, the user can maybe
better see what the actual problem is.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 server/src/connection.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/server/src/connection.rs b/server/src/connection.rs
index 1688fb3..201d65b 100644
--- a/server/src/connection.rs
+++ b/server/src/connection.rs
@@ -747,13 +747,17 @@ macro_rules! try_request {
 
             if let Some(err) = last_err {
                 log::error!("API client error (giving up) - {err:?}");
+                Err(proxmox_client::Error::Client(err))
             } else if timed_out {
                 log::error!("API client timed out, no remotes reachable, giving up");
+                Err(proxmox_client::Error::Other(
+                    "failed to perform API request: timed out",
+                ))
+            } else {
+                Err(proxmox_client::Error::Other(
+                    "failed to perform API request: unknown error",
+                ))
             }
-
-            Err(proxmox_client::Error::Other(
-                "failed to perform API request",
-            ))
         })
     };
 }
-- 
2.39.5





More information about the pdm-devel mailing list