Status: Untriaged
Owner: ----
New issue 4332 by [email protected]: JSON.parse() fails without helpful
line number of line offset information when unexpected token is encountered
https://code.google.com/p/v8/issues/detail?id=4332
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36
Steps to reproduce the problem:
- Open Chrome developer tools
- Simulate your site's JavaScript parsing an invalid JSON payload from,
say, your development server by typing:
JSON.parse('{\n"description":\n"About to get a complaint about an
unexpected" token "at some unknown position in my JSON"\n}');
What is the expected behavior?
1. JSON parse error
2. I'm given a (JSON) line number and character offset for the invalid token
What went wrong?
- JSON line number is not included in the error message
- JSON character offset is not included in the error message
The error message, which is missing line number and offset, is:
Uncaught SyntaxError: Unexpected token t
at Object.parse (native)
at <anonymous>:2:6
at Object.InjectedScript._evaluateOn (<anonymous>:905:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:838:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)
Chrome version: 44.0.2403.107 Channel: stable
OS Version: OS X 10.10.4
As a result, debugging invalid JSON (e.g. some static JSON file on my
development server) becomes very difficult and Chrome Dev Tools is of no
assistance.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.