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

JSON.parse("") gives very ambigious "Syntax Error". #804

Closed
nojvek opened this issue Apr 13, 2016 · 2 comments
Closed

JSON.parse("") gives very ambigious "Syntax Error". #804

nojvek opened this issue Apr 13, 2016 · 2 comments

Comments

@nojvek
Copy link

nojvek commented Apr 13, 2016

JSON.parse("")
$ ch.exe jsonParseEmpty.js
SyntaxError: Syntax error
   at Global code (d:\personal\chakracore\build\vcbuild\bin\x64_debug\test.js:1:1)

'Syntax Error' is very ambiguous error. It could mean a lot of things. When its part of a large callstack, I would think its a javascript syntax error somewhere in my js files. The callstack doesn't even mention JSON.parse.

Chrome gives

VM145:1 Uncaught SyntaxError: Unexpected end of JSON input(…) 

Ideal error should mention something like "JSON.parse Syntax error: Empty string" or "JSON.parse Syntax Error: unexpected end of json input."

@dilijev
Copy link
Contributor

dilijev commented May 4, 2016

@nojvek I think this would be relatively straightforward to tackle. Would you like to do the honors?

Exception seems to be coming from:
lib\Runtime\Library\JSONParser.cpp:412 - JSON::JSONParser::ParseObject
See the following for the JSON.parse() entry point:
lib\Runtime\Library\JSON.cpp:22 - JSON::Parse

@nojvek
Copy link
Author

nojvek commented May 4, 2016

Sure, I'll take a stab at it Doug.

On Wed, May 4, 2016 at 10:54 AM, Doug Ilijev [email protected]
wrote:

@nojvek https://github.com/nojvek I think this would be relatively
straightforward to tackle. Would you like to do the honors?

Exception seems to be coming from:
lib\Runtime\Library\JSONParser.cpp:412 - JSON::JSONParser::ParseObject
See the following for the JSON.parse() entry point:
lib\Runtime\Library\JSON.cpp:22 - JSON::Parse


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#804 (comment)

chakrabot pushed a commit that referenced this issue Jun 6, 2016
…rors

Merge pull request #1001 from nojvek:master
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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants