snafu icon indicating copy to clipboard operation
snafu copied to clipboard

Print multi-line errors on their own lines in `Report`

Open judemille opened this issue 2 years ago • 2 comments

I've run into a funny problem -- ParseErrors from winnow get displayed on multiple lines. If, for example, the first line contains a line that has an error in it, and then the second line contains a caret pointing to the text, the current Display impl on Report will mess that up.

Fixing this should be simple -- I can probably implement it fairly easily after some discussion on how best to go about fixing it. I figure the best solution is to break multi-line errors onto their own lines, and then add a line or two of padding after, before displaying the next error.

judemille avatar Jan 12 '24 16:01 judemille

Can you show what their error looks like when formatted by itself and then what it looks like from Report?

shepmaster avatar Jan 12 '24 17:01 shepmaster

Here is an example where I send the error through .map_err(|e| { eprintln!("parse error:\n\n{}\n\n", e.cause().unwrap()); e }):

The first output is my map_err, the second is the Report. image

The faulty column is SIDBY___.

judemille avatar Jan 14 '24 20:01 judemille