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

Better remap-lang error reporting #4803

Closed
JeanMertz opened this issue Oct 29, 2020 · 3 comments · Fixed by #6023
Closed

Better remap-lang error reporting #4803

JeanMertz opened this issue Oct 29, 2020 · 3 comments · Fixed by #6023
Assignees
Labels
domain: vrl Anything related to the Vector Remap Language type: enhancement A value-adding code change that enhances its existing functionality.

Comments

@JeanMertz
Copy link
Contributor

We should do another pass over the remap-lang implementation, and improve its error messages.

There are two areas we should improve:

  1. The parser errors generated by the pest library are based on the rules we define in the grammar. These rules are sometimes named reasonable for internal use, but aren't as useful in error messages. We can leverage Pest's error manipulation API to improve this situation.

  2. Parser errors show line and column numbers with a visual representation of the code that failed to compile. However, our custom errors do not, which makes them less easy to parse. We don't need to get too fancy here, but it would be nice if we could make sure the error messages are as clear as they can be (by providing whatever relevant context we can in the messages themselves), and perhaps add the line number where the error occurred (this is information we have).

@JeanMertz JeanMertz added type: enhancement A value-adding code change that enhances its existing functionality. domain: vrl Anything related to the Vector Remap Language labels Oct 29, 2020
@JeanMertz JeanMertz self-assigned this Nov 9, 2020
@JeanMertz JeanMertz added this to the 2020-11-09: Augur of Dunlain milestone Nov 9, 2020
@binarylogic binarylogic added this to the 2021-01-04 Xenomass Well milestone Dec 26, 2020
@JeanMertz
Copy link
Contributor Author

ref: #5876 (comment)

@JeanMertz
Copy link
Contributor Author

ref: #5911 (comment)

We should improve this error (and others) to actually print the expression and provide a solution.

@JeanMertz
Copy link
Contributor Author

Leaving this for reference, we should try to use the codespan crate to provide useful error messages when a program fails to compile.

For an example, see: https://raw.githubusercontent.com/brendanzab/codespan/132f4db0f568ae160b1a47510d1ef21d0223d6f3/codespan-reporting/assets/readme_preview.svg

We could also look into alternative crates, but they seem less feature-full or unmaintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: vrl Anything related to the Vector Remap Language type: enhancement A value-adding code change that enhances its existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants