From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Gabriel Goller <g.goller@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 2/2] print full anyhow error context
Date: Thu, 15 Feb 2024 10:33:46 +0100 (CET) [thread overview]
Message-ID: <202673785.2180.1707989626186@webmail.proxmox.com> (raw)
In-Reply-To: <20240214095207.37024-2-g.goller@proxmox.com>
As discussed offline, we first need a strategy how to handle error
properly (i.e. we talked about using context instead of string concatenation).
So I will not apply this for now..
> On 14.2.2024 10:52 CET Gabriel Goller <g.goller@proxmox.com> wrote:
>
>
> 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
>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-02-15 9:33 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 ` [pbs-devel] [PATCH proxmox-backup v2 2/2] print full anyhow error context Gabriel Goller
2024-02-15 9:33 ` Dietmar Maurer [this message]
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=202673785.2180.1707989626186@webmail.proxmox.com \
--to=dietmar@proxmox.com \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox