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

error returned from Capture interface does not contain position and is not wrapped #137

Open
torbenschinke opened this issue Apr 8, 2021 · 3 comments

Comments

@torbenschinke
Copy link

Sometimes it is useful to return an error from the Capture(values []string) error method. However the final returned parser error is not decorated with the position properly.

Actually the returned error is a v2.parseError but it does not contain a valid lexer.Position. Also the original error is discarded and just the message is kept instead of using the wrappingParseError type.

It seems like that the decorate function in setField (nodes.go:553) should do the job, but it does not use the tokens position. Also it just uses the parseError type instead of the wrappingParseError.

@torbenschinke torbenschinke changed the title wrapped error returned from Capture interface does not contain position and is not wrapped error returned from Capture interface does not contain position and is not wrapped Apr 8, 2021
@alecthomas
Copy link
Owner

Definitely sounds like a bug, thanks!

@alecthomas
Copy link
Owner

If you'd like to send a PR, they're always welcome.

@torbenschinke
Copy link
Author

ok, I'll prepare one

torbenschinke added a commit to torbenschinke/participle that referenced this issue Apr 9, 2021
torbenschinke added a commit to torbenschinke/participle that referenced this issue Apr 9, 2021
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