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

Print more error context #116

Open
samhh opened this issue May 3, 2022 · 1 comment
Open

Print more error context #116

samhh opened this issue May 3, 2022 · 1 comment

Comments

@samhh
Copy link
Contributor

samhh commented May 3, 2022

Off the back of #114/#115, it'd be great to have more lines/context around errors. Example:

./x-all.json:6:21:
  |
6 |     "message": "{x, bad}"
  |                     ^^^^^^
unexpected "bad}"<newline>  },<newline>  "
expecting "boolean", "date", "number", "plural", "select", "selectordinal", "time", or white space

I can see the line number and the problem itself, which is good, however ideally it'd also show the line above with the translation name. In an ideal world we would always show everything in the object:

./x-all.json:6:21:
  |
5 |   "f": {
6 |     "message": "{x, bad}"
  |                     ^^^^^^
7 |   }
  |
unexpected "bad}"<newline>  },<newline>  "
expecting "boolean", "date", "number", "plural", "select", "selectordinal", "time", or white space
@samhh
Copy link
Contributor Author

samhh commented Nov 1, 2022

This is relevant to linting output as well as of #179.

It's unclear how well this would scale. The object may be large and the message mayn't be at the top.

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