zkat / miette

Fancy extension for std::error::Error with pretty, detailed diagnostic printing.
https://docs.rs/miette
Apache License 2.0
1.85k stars 106 forks source link

fix(invalid span): skip the snippet when read_span fails #347

Closed Nahor closed 4 months ago

Nahor commented 4 months ago

Fixes: https://github.com/zkat/miette/issues/219

When a snippet couldn't be read (typically because the span didn't fit within the source code), it and the rest of the diagnostic were silently dropped, which was confusing to the developer. Now, in place of the snippet, print an error message with the name of the failed label and the error it triggered, then proceed with the rest of the diagnostic (footer, related, ...)

This is what it looks like: image

Nahor commented 4 months ago

The CI failure should be addressed with #348