public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager] server: connection: improve error messages for remotes
Date: Fri, 11 Apr 2025 16:05:57 +0200	[thread overview]
Message-ID: <20250411140557.1494389-1-d.csapak@proxmox.com> (raw)

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@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



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


             reply	other threads:[~2025-04-11 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 14:05 Dominik Csapak [this message]
2025-04-14 14:53 ` [pdm-devel] applied: " Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250411140557.1494389-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal