-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixes #804 Json parsing errors mention JSON.parse in errors #1001
Conversation
Hi @nojvek, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
Thanks @nojvek, these new error messages are definitely more helpful. The error stack will have the line column information for the source of the throw, which will be where the JSON.parse call occurred, so we do have that already. Could also be useful to have character offset (or line/column?) information for the source of the error in the JSON string passed to parse. I don't know if that would require much additional work on in the JSON parser or not. Certainly this can be raised as a new separate @abchatra any concerns over adding new error messages? |
Right now there seems to be a LSC_ERROR_MSG(..) macro definition of a How do I throw a syntax error with a dynamically created string ? On Wed, May 18, 2016 at 2:03 PM, Ian Halliday [email protected]
|
Look at I believe you should be able to move the errors to |
I am happy to see improvement in the error messages. |
Thanks abchatra for the help today. I have made the fixes to show the position just like v8 does for JSON.parse. wdyt? |
Looks great! Thanks @nojvek, I'll get this merged. |
@nojvek turns out we have some JSON tests that do not run in jenkins currently because they depend on timezone. You will need to manually run these two tests, I also just noticed that your new test |
Note the json tests that don't run in jenkins because of their timezone dependency is an understood issue that we have not fixed yet. It depends on PST timezone. |
return object; | ||
} | ||
|
||
default: | ||
Js::JavascriptError::ThrowSyntaxError(scriptContext, ERRsyntax); | ||
m_scanner.ThrowSyntaxError(JSERR_JsonSyntax); | ||
return NULL; |
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.
Not required. This statement won't be reached.
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.
Without this C++ won't compile.
e:\personal\chakracore\lib\runtime\library\jsonparser.cpp(415): warning C4715: 'JSON::JSONParser::ParseObject': not all control paths return a value
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.
That is because JSONScanner::ThrowSyntaxError
is not marked with __declspec(noreturn)
.
Probably reasonable to change the definition of JSONScanner::ThrowSyntaxError
to:
void __declspec(noreturn) ThrowSyntaxError(int wErr)
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.
done.
Ensured tests pass in runtests.cmd -x64 -debug and added syntaxError.js to rl.xml |
@nojvek you forgot to update the baseline for |
Oh forgot that. I updated Json/jx2.js On Wednesday, June 1, 2016, Ian Halliday [email protected] wrote:
|
@nojvek when you get a chance please update |
Done. Ran all 1655 tests and confirmed they passed. Not sure why baseline for jx2.js was called jx3.js. I've renamed to Soz for delay On Thursday, June 2, 2016, Ian Halliday [email protected] wrote:
|
Awesome, thanks for the rename. I don't know why it was different either. Probably some historical reason that didn't get cleaned up nicely. |
Would be great to see this go in today. Let me know if you need anything else from my side. Thanks |
@nojvek we're all good, merged! Thanks for improving these error messages |
That's awesome. Thanks Ian. On Mon, Jun 6, 2016 at 2:18 PM, Ian Halliday [email protected]
|
Thank you @nojvek |
Note that we're tracking the timezone-sensitive tests issue in #319 |
I added JSON.parse specific errors. It still doesn't feel very clean as there is no column info. Would this be relatively easy to add?