public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	 Wolfgang Bumiller <w.bumiller@proxmox.com>,
	Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2] api2/tape/restore: restore_snapshot_archive: only ignore tape errors
Date: Wed, 14 Apr 2021 10:51:24 +0200 (CEST)	[thread overview]
Message-ID: <804431853.2884.1618390284589@webmail.proxmox.com> (raw)

> Now, while this is not happening a lot for the `Other` case, it does
> happen quite a few times for the `Disk` case, so you could also add a
> few little helpers for some "quality of life" improvements:
> 
>     impl RestoreError {
>         fn other<T: ToString>(err: T) -> Self {
>             RestoreError::Other(err.to_string())
>         }
> 
>         fn disk<T: ToString>(err: T) -> Self {
>             RestoreError::Disk(err.to_string())
>         }
> 
>         fn tape<T: Into<Error>>(err: T) -> Self {
>             RestoreError::Tape(err.into())
>         }
>     }

I like that idea, but I don't think it is a good idea to convert Errors to strings.
So I would use:

#[derive(thiserror::Error, Debug)]
pub enum RestoreError {
    #[error("tape error: {0}")]
    Tape(Error),
    #[error("disk error: {0}")]
    Disk(Error),
    #[error("{0}")]
    Other(Error),
}




             reply	other threads:[~2021-04-14  8:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  8:51 Dietmar Maurer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-04-13 12:05 Dominik Csapak
2021-04-14  8:41 ` 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=804431853.2884.1618390284589@webmail.proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=w.bumiller@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