Skip to content
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

Local build doesn't catch HTML parsing errors #290

Closed
noamr opened this issue Feb 7, 2024 · 0 comments · Fixed by #291
Closed

Local build doesn't catch HTML parsing errors #290

noamr opened this issue Feb 7, 2024 · 0 comments · Fixed by #291

Comments

@noamr
Copy link

noamr commented Feb 7, 2024

Often I get a "success!" in local build and then the PR build throws an error (usually about missing end tags for <li> or something similar) when parsing the HTML. This makes it so that I can't rely on the local build and have to do roundtrips with github to debug tiny HTML grammar errors... We should find a way to reflect these errors in local build.

@noamr noamr changed the title Local build doesn't catch parsing errors Local build doesn't catch HTML parsing errors Feb 7, 2024
domenic added a commit that referenced this issue Apr 25, 2024
This fixes #290, by outputting the parse errors encountered by the Rust build step's parser. Previously they were being stored in the RcDom instance's errors vector, and ignored. Now they are threaded through to the final io::Result, and then output by main().

The hardest part of this was adding line numbers to the errors. Doing this necessitated creating a wrapper for RcDom, called RcDomWithLineNumbers, which implements TreeSink with two methods parse_error() and set_current_line() given custom behavior, while the other many methods just delegate to RcDom's implementation.

Additionally, this enables exact_errors as a parser option, which provides slightly more information in a couple of cases related to character references.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant