rust: The use of color_eyre and allotted tracing to yield higher error messages to the consumer


At the moment we’re the use of the todo!()(*5*) macro which is superb for simulating when our program panics. The mistake message that we get will also be stepped forward upon.

We will be able to take a look at color-eyre that may let us maintain the mistakes we obtain to be extra visible and human-readable.

The todo!(*5*) macro comes in handy and it additionally exposes what
occurs if our application panics.

(*10*)thread 'primary' panicked at 'now not but carried out', src/
be aware: run with `RUST_BACKTRACE=1` surroundings variable to show a backtrace(*5*)

This might be each extra readable and include additional information
whilst additionally being coloured the use of (*2*)color_eyre.

(*10*)The application panicked (crashed).
Message: now not but carried out
Location: src/ Backtrace left out.
Run with RUST_BACKTRACE=1 surroundings variable to show it.
Run with RUST_BACKTRACE=complete to incorporate supply snippets.(*5*)

We're going to use cargo-edit
so as to add the bundle to our Shipment.toml.

(*10*)shipment set up cargo-edit
shipment upload color_eyre(*5*)

primary(*5*) can go back Consequence(*5*), so we will use color_eyre(*5*)'s
Consequence(*5*) as our go back price and color_eyre::set up(*5*) to
set up the default panic and mistake reporting hooks.
set up(*5*) returns a Consequence(*5*) so we will be able to use ?(*5*) to maintain
any mistakes if vital.

We have not proven off the whole lot that color_eyre is succesful
of. Along with panic dealing with, color_eyre lets in us to
monitor additional info within the context of our mistakes
and come with tips through profiting from allotted
tracing infrastructure.

We're going to see extra of ways this is helping as we construct out the CLI.