From 958920709cc661a2b3eaa2f81e4f5598bb9b8a97 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 27 Dec 2024 09:50:46 -0800 Subject: [PATCH] tools: enable fancy miette errors in `crowtty` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At some point (probably when `crowtty` was separated out into its own binary in #342), the `miette` dependency's `"fancy"` feature flag, which makes the debug print format for errors actually look nice and include cause chains, was eaten. This is a bummer, because having cause chains is important in order to understand the error message. This commit re-enables the `"fancy"` feature flag for `miette` in `crowtty`'s `Cargo.toml'. Prior to this change, errors looked like this: ```console eliza@theseus ~/Code/mnemos $ cargo run -p crowtty -- serial /dev/ttyUSB1 --verbose --trace trace Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.39s Running `target/debug/crowtty serial /dev/ttyUSB1 --verbose --trace trace` Error: Diagnostic { message: "failed to connect to /dev/ttyUSB1 (@ 115200)" } NOTE: If you're looking for the fancy error reports, install miette with the `fancy` feature, or write your own and hook it up with miette::set_hook(). ``` ...which I think we can all agree is not that useful. Now, the error looks like this: ```console eliza@theseus ~/Code/mnemos $ cargo run -p crowtty -- serial /dev/ttyUSB1 --verbose --trace trace Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.22s Running `target/debug/crowtty serial /dev/ttyUSB1 --verbose --trace trace` Error: × failed to connect to /dev/ttyUSB1 (@ 115200) ╰─▶ Device or resource busy ``` This actually explains what went wrong, which seems good to me. --- tools/crowtty/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/crowtty/Cargo.toml b/tools/crowtty/Cargo.toml index f3048423..30a97990 100644 --- a/tools/crowtty/Cargo.toml +++ b/tools/crowtty/Cargo.toml @@ -46,3 +46,4 @@ features = ["std"] [dependencies.miette] workspace = true +features = ["fancy"]