[pbs-devel] [PATCH proxmox v3 1/4] CLI: print fatal errors including causes
Wolfgang Bumiller
w.bumiller at proxmox.com
Tue Jun 18 15:42:13 CEST 2024
On Mon, Jun 17, 2024 at 10:12:51AM GMT, Gabriel Goller wrote:
> From: Fabian Grünbichler <f.gruenbichler at proxmox.com>
>
> as a first step of improving our error handling story, printing context
> and causes if the error contains them.
>
> The downside to adding context is that the default Display implementation
> will *just* print the context, which hides the root cause. This is why
> we print the errors using the pretty-print formatter in this change.
>
> More info in `proxmox-router/README.rst`.
This file will not be seen by anyone. It's also not where I'd expect
generic coding style advice and doesn't *really* have much to do with
the router crate.
This info might be better in the developer docs / wiki.
So please drop the file for now.
(Also: such files are better as a separate patch, so it can easily be
dropped while applying.)
> diff --git a/proxmox-router/src/cli/command.rs b/proxmox-router/src/cli/command.rs
> index 7a26ffb9..d5522f12 100644
> --- a/proxmox-router/src/cli/command.rs
> +++ b/proxmox-router/src/cli/command.rs
> @@ -83,7 +83,7 @@ async fn handle_simple_command_future(
> }
> }
> Err(err) => {
> - eprintln!("Error: {}", err);
> + eprintln!("Error: {:?}", err);
Could go straight to
eprintln!("Error: {err:?}");
in both cases.
> return Err(err);
> }
> }
> @@ -135,7 +135,7 @@ fn handle_simple_command(
> }
> }
> Err(err) => {
> - eprintln!("Error: {}", err);
> + eprintln!("Error: {:?}", err);
> return Err(err);
> }
> }
> --
> 2.43.0
More information about the pbs-devel
mailing list