-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
Provide a more robust error message if JSON is invalid. #177
Conversation
Current output looks like this:
Here's an example output of how it would look if we were to highlight the syntax error
Thoughts? Not sure if it adds any more value. |
Would it be possible to add full path to the config and number of line causing the error? |
Each bit more of info you can supply to folks always helps, I say. :] |
@mtakac The full path will be displayed, I changed it for the example but it will look like
Adding the line number should be trivial but the issue is that the config file is usually just 1 line unless the user modifies it to be pretty.
Definitely! Though I wanted to get feedback in case too much info can be overwhelming for the user but I guess it couldn't hurt in this scenario since they're already running into an issue. |
👍 looks great and clear. |
The latest commit makes the error output:
|
We could also write the config file pretty--it's not costly for such a small file, and if it would make it easier to give good error messages, that's a plus. |
@kytrinyx sure, do you want me to get that in with this PR or in a different one? |
|
Thanks @Tonkpils! |
Provide a more robust error message if JSON is invalid.
Fixes #170
With
json.SyntaxError
we also have theOffset
at which the error is, so we can highlight where the syntax error is. I can work on that if that's something we want but this should be enough to get going.