Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates exn’s default Debug formatting to render error trees more compactly by removing the extra blank separator line and switching to box-drawing characters.
Changes:
- Update
write_exnto print child frames using├──/└──connectors and│indentation. - Refresh Insta snapshots to match the new compact
Debugoutput across linear and tree-shaped error graphs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| exn/src/debug.rs | Changes the Debug tree rendering to use box-drawing connectors and removes the extra separator line. |
| exn/tests/snapshots/main__tree_error.snap | Updates expected tree-shaped debug output to new connector style. |
| exn/tests/snapshots/main__linear_error.snap | Updates expected linear-chain debug output to new connector style. |
| exn/tests/snapshots/main__result_ext.snap | Updates expected debug output for ResultExt case. |
| exn/tests/snapshots/main__new_with_source.snap | Updates expected debug output for Exn::new with source. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (i, child) in children.iter().enumerate() { | ||
| write!(f, "\n{}|", prefix)?; | ||
| write!(f, "\n{}|-> ", prefix)?; | ||
| if i != children_len - 1 { | ||
| write!(f, "\n{}├── ", prefix)?; | ||
| } else { | ||
| write!(f, "\n{}└── ", prefix)?; | ||
| } |
| if i != children_len - 1 { | ||
| write!(f, "\n{}├── ", prefix)?; | ||
| } else { | ||
| write!(f, "\n{}└── ", prefix)?; | ||
| } |
There was a problem hiding this comment.
This new symbol appears to be a general UTF-8 character rather than standard ASCII. We have previously encountered issues where this displays as garbled text in environments that do not support UTF-8.
Because of this, we prefer to keep the default format using simple ASCII. We want to ensure the default setting remains as simple as possible to maintain compatibility across more scenarios.
If you require a more sophisticated display, we have an example available that demonstrates how to create a customized display - https://github.com/fast/exn/blob/534fda198c61ab4021fccabe4778fa6c87f6470c/examples/src/custom-layout.rs
There was a problem hiding this comment.
Thanks for the quick review!
I'm OK with plain ASCII characters. My real issue is with the blank lines. I'd like to use all the limited screen space to render as much as errors clearly if possible. I wonder whether there is a middle ground 🤔
There was a problem hiding this comment.
You can try changing the characters to the ASCII version and updating the snapshot to see the result.
Currently, there are some failing test cases in the CI. You can take a look and see how to fix them; I suspect it might be related to examples.
95f1504 to
2065b51
Compare
2065b51 to
2f7daec
Compare
Removes the empty line between errors and use box-drawing characters for compact rendering.