router: cli: print fatal errors including causes

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.

Originally-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
[WB: prefix commit message with crate]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Gabriel Goller 2024-06-18 16:22:00 +02:00 committed by Wolfgang Bumiller
parent 5295da1b8a
commit 8240e5022f

View File

@ -83,7 +83,7 @@ async fn handle_simple_command_future(
} }
} }
Err(err) => { Err(err) => {
eprintln!("Error: {}", err); eprintln!("Error: {err:?}");
return Err(err); return Err(err);
} }
} }
@ -135,7 +135,7 @@ fn handle_simple_command(
} }
} }
Err(err) => { Err(err) => {
eprintln!("Error: {}", err); eprintln!("Error: {err:?}");
return Err(err); return Err(err);
} }
} }