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

Some parser inputs are implicitly rejected due to EOF #47

Closed
apasel422 opened this issue Aug 2, 2023 · 2 comments
Closed

Some parser inputs are implicitly rejected due to EOF #47

apasel422 opened this issue Aug 2, 2023 · 2 comments

Comments

@apasel422
Copy link

For example:

parser.parse('x;a')

and

parser.parse('x;a=')

throw TypeError: Cannot read properties of undefined (reading 'match'), presumably because the Parser.lookChar() method is called via Parser.parseKey and Parser.parseBareItem, respectively, without checking Parser.eof() first.

It would be nice to have better error messages in these cases, e.g. ParseError: Unexpected end of input.

Perhaps lookChar itself could call eof()?

@evert
Copy link
Collaborator

evert commented Aug 2, 2023

I agree, ideally we never throw a TypeError, and always a ParseError. I'm going to modify the unittests to check for this, I suspect that there's more cases.

@evert
Copy link
Collaborator

evert commented Aug 3, 2023

Released as v1.0.1

apasel422 added a commit to apasel422/attribution-reporting-api that referenced this issue Aug 3, 2023
apasel422 added a commit to WICG/attribution-reporting-api that referenced this issue Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants