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 cases with messages #63

Open
am11 opened this issue Feb 22, 2020 · 0 comments
Open

Error cases with messages #63

am11 opened this issue Feb 22, 2020 · 0 comments

Comments

@am11
Copy link
Contributor

am11 commented Feb 22, 2020

The spec tests covering the error cases are currently exercised as:

  • a sentinel indicator whether there should be an error
  • which tokens were parsed before the error

A next level of improvement could be if the reason of error is spelled out in terms of explicit error messages. Some benefits are:

  • captures the test author's intent.
  • forgoes the ambiguities; depending on the algorithm used by the implementations:
    • there could be multiple candidate validations which might be violating and streamlining it would bring about consistency across implementations.
    • there could be some potentially wrong assumption which may lead to some other ambiguities in implementation; which could be avoided early on.

Current spec test runners will continue to work with binary logic, by checking the existence of error tag (as happening today). Some implementations may chose to align error messages exactly as the spec test describes it for hardening.

For the existing (73) error cases, error messages could be proofread and included in spec test, after collected from certain implementation like libyaml; including the location of error but without the stacktrace e.g.:

Failed to parse YAML. mapping values are not allowed in this context.
  in /path/to/file.yaml, line: 2, column: 8
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

1 participant