-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Improve error reporting #79381
base: master
Are you sure you want to change the base?
Improve error reporting #79381
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-requesting reviews from non-collaborators: @andrei8l
466fff4
to
2928aaa
Compare
-JSON syntax errors say they are syntax errors, to help people understand how to resolve them. -The line and character offset of JSON errors has been made explicit, instead of requiring you to guess what the numbers mean. -The C++ source file names/etc were made more explicit as well, which should hopefully reduce people asking "I can't find this .cpp file on my game, where is it"
2928aaa
to
a4eeeb0
Compare
We apparently have an entire test suite that test errors are reported they way they are reported |
Unfortunately, I find your last "after" image very confusion. It talks about an object beginning at a line that marks the end of an object, with the next line starting a new one. |
Mostly that the errors are thrown at all. But in this case since I'm updating the error messages I do need to update the messages in the tests as well. Not a big deal.
I don't really disagree, but the caret position was pre-existing. I could look into changing it. |
Or you could change the message to match the caret position. |
Summary
Infrastructure "Improve error reporting"
Purpose of change
Our errors aren't always helpful in explaining what they mean. This confuses users (who go looking for C++ source files which they don't have) and contributors (who may troubleshoot the wrong thing until they realize what's going on).
Describe the solution
Make them more helpful.
-JSON syntax errors say they are syntax errors, to help people understand how to resolve them.
-Errors which start at the beginning of an object instead of at a member or place of error explicitly say the reported line is the beginning of the object. This has confused many, many people. Hopefully with the changes it should confuse less people.
-The line and character offset of JSON errors has been made explicit, instead of requiring you to guess what the numbers mean.
-The C++ source file names/etc were made more explicit as well, which should hopefully reduce people asking "I can't find this .cpp file on my game, where is it"
Describe alternatives you've considered
The errors which point to the start of the object could be made even better. We shouldn't even show context outside of the error object. We could also try to grab the id of the object and report that explicitly, so the contributor knows exactly what object is meant.
But that seemed like it would be a lot more difficult to implement. For example the object in question might not have an
id
member.Testing
Intentionally introduce some errors, trigger the errors.
before (image from community discord):
after:
Additional context