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

Avoid misuse in error handling in apollo-parser #833

Open
goto-bus-stop opened this issue Feb 13, 2024 · 0 comments
Open

Avoid misuse in error handling in apollo-parser #833

goto-bus-stop opened this issue Feb 13, 2024 · 0 comments

Comments

@goto-bus-stop
Copy link
Member

Note: this is just about the implementation of the apollo-parser crate, and not relevant for end users.

There's currently an internal kind-of footgun in apollo-parser: if you are parsing something in a loop, and hit an error, and use p.err(), the parser does not advance. That means you can get into an infinite loop. This is partially addressed by having p.peek_while(), which we will have to be diligent about in reviews. But it's still something to keep in mind that is not that clear when reading a PR.

In general, it would be good to have some documented approach for the difference between p.err() and p.err_and_pop(). When should one be used over the other?

This is spun off from #828 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant