all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 3/3] clippy: sdn-client: fix 'large size difference between variants' for error type
Date: Wed, 20 May 2026 15:13:47 +0200	[thread overview]
Message-ID: <20260520131348.332987-4-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260520131348.332987-1-l.wagner@proxmox.com>

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---

Notes:
    Not sure if we should just add an ignore instead

 server/src/sdn_client.rs | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/server/src/sdn_client.rs b/server/src/sdn_client.rs
index 95e4d69b..f56519a6 100644
--- a/server/src/sdn_client.rs
+++ b/server/src/sdn_client.rs
@@ -2,7 +2,7 @@ use std::error::Error as StdError;
 use std::sync::Arc;
 use std::time::Duration;
 
-use anyhow::{self, bail, Context};
+use anyhow::{self, bail, format_err, Context};
 
 use futures::{future::join_all, stream::FuturesUnordered, StreamExt, TryFutureExt};
 use pdm_api_types::{remotes::Remote, RemoteUpid};
@@ -25,7 +25,7 @@ pub struct LockedSdnClient {
 
 #[derive(Debug)]
 pub enum LockedSdnClientError {
-    Client(proxmox_client::Error),
+    Client(Box<proxmox_client::Error>),
     Other(anyhow::Error),
 }
 
@@ -49,7 +49,7 @@ impl std::fmt::Display for LockedSdnClientError {
 
 impl From<proxmox_client::Error> for LockedSdnClientError {
     fn from(value: proxmox_client::Error) -> Self {
-        Self::Client(value)
+        Self::Client(Box::new(value))
     }
 }
 
@@ -219,15 +219,20 @@ impl<C> LockedSdnClients<C> {
                         }
                     }
 
-                    return match &error {
-                        LockedSdnClientError::Client(proxmox_client::Error::Api(status, _msg))
-                            if *status == 501 =>
-                        {
-                            bail!("remote {} does not support the sdn locking api, please upgrade to PVE 9 or newer!", remote.id)
+                    return match error {
+                        LockedSdnClientError::Client(error) => match *error {
+                            proxmox_client::Error::Api(status_code, _msg) if status_code == 501 => {
+                                Err(format_err!("remote {} does not support the sdn locking api, please upgrade to PVE 9 or newer!", remote.id))
+                            }
+                            _ => Err(error).with_context(|| format!(
+                                "could not lock sdn configuration for remote {}",
+                                remote.id
+                            )),
                         }
-                        _ => Err(error).with_context(|| {
-                            format!("could not lock sdn configuration for remote {}", remote.id)
-                        }),
+                        _ => Err(error).with_context(|| format!(
+                            "could not lock sdn configuration for remote {}",
+                            remote.id
+                        )),
                     };
                 }
             };
-- 
2.47.3





  parent reply	other threads:[~2026-05-20 13:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 13:13 [PATCH datacenter-manager 0/3] various clippy fixes Lukas Wagner
2026-05-20 13:13 ` [PATCH datacenter-manager 1/3] clippy: cli: acme: redundant field names in struct initialization Lukas Wagner
2026-05-20 13:13 ` [PATCH datacenter-manager 2/3] clippy: pdm-client: use parameter type for pve_list_storages Lukas Wagner
2026-05-20 13:13 ` Lukas Wagner [this message]
2026-05-21 12:57   ` [PATCH datacenter-manager 3/3] clippy: sdn-client: fix 'large size difference between variants' for error type Wolfgang Bumiller
2026-05-21 13:00 ` partially-applied: [PATCH datacenter-manager 0/3] various clippy fixes 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=20260520131348.332987-4-l.wagner@proxmox.com \
    --to=l.wagner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal