-
-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(invalid span): skip the snippet when read_span fails #347
Conversation
src/handlers/graphical.rs
Outdated
writeln!( | ||
f, | ||
" [{} `{}`: {:?}]", | ||
"no snippet, error in label".style(self.theme.styles.error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"no snippet, error in label".style(self.theme.styles.error), | |
"Failed to read contents for label".style(self.theme.styles.error), |
src/handlers/graphical.rs
Outdated
Err(err) => { | ||
writeln!( | ||
f, | ||
" [{} `{}`: {:?}]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should print the source name, at least. Possibly the span, as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no name at this point. We only have a SourceCode
trait object, which will give the name but only if the read_span succeeds.
The CI failure should be addressed with #348 |
Fixes: zkat#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, ...)
Fixes: #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: