all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v2 2/2] print full anyhow error context
Date: Wed, 14 Feb 2024 10:52:02 +0100	[thread overview]
Message-ID: <20240214095207.37024-2-g.goller@proxmox.com> (raw)
In-Reply-To: <20240214095207.37024-1-g.goller@proxmox.com>

When printing an anyhow::Error using the "{}" formatter, only the outer
error will be printed. When using "{:#}" (pretty-print), the whole error
with all the contexts will be displayed.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pbs-client/src/pxar/create.rs                            | 2 +-
 pbs-client/src/pxar_backup_stream.rs                     | 2 +-
 proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index 6dac95d9..4cb095cd 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -105,7 +105,7 @@ impl std::error::Error for ArchiveError {}
 
 impl fmt::Display for ArchiveError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "error at {:?}: {}", self.path, self.error)
+        write!(f, "error at {:?}: {:#}", self.path, self.error)
     }
 }
 
diff --git a/pbs-client/src/pxar_backup_stream.rs b/pbs-client/src/pxar_backup_stream.rs
index 22a6ffdc..61aee7c2 100644
--- a/pbs-client/src/pxar_backup_stream.rs
+++ b/pbs-client/src/pxar_backup_stream.rs
@@ -68,7 +68,7 @@ impl PxarBackupStream {
             .await
             {
                 let mut error = error2.lock().unwrap();
-                *error = Some(err.to_string());
+                *error = Some(format!("{:#}", err));
             }
         };
 
diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
index c2055222..d0e09e15 100644
--- a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
+++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
@@ -361,7 +361,7 @@ fn extract(
                 }
                 .await;
                 if let Err(err) = result {
-                    error!("pxar streaming task failed - {}", err);
+                    error!("pxar streaming task failed - {:#}", err);
                 }
             });
         } else if format == "tar" {
-- 
2.43.0





  reply	other threads:[~2024-02-14  9:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14  9:52 [pbs-devel] [PATCH proxmox-backup v2 1/2] fix #4975: client: ignore E2BIG error flag Gabriel Goller
2024-02-14  9:52 ` Gabriel Goller [this message]
2024-02-15  9:33   ` [pbs-devel] [PATCH proxmox-backup v2 2/2] print full anyhow error context Dietmar Maurer
2024-02-15  8:26 ` [pbs-devel] [PATCH proxmox-backup v2 1/2] fix #4975: client: ignore E2BIG error flag Dietmar Maurer
2024-02-15  9:37 ` [pbs-devel] applied: " Dietmar Maurer

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=20240214095207.37024-2-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pbs-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