Status: Untriaged
Owner: ----
New issue 6551 by
michalwa...@gmail.com: JSON.parse errors can be user-friendly for short strings
https://bugs.chromium.org/p/v8/issues/detail?id=6551Version: All
OS: All
Architecture: All
What steps will reproduce the problem?
Consider error messages for these codes:
JSON.parse(NaN)
JSON.parse(undefined); // very common bug
JSON.parse(Infinity);
JSON.parse('Bad string');
JSON.parse({});
What is the expected output?
Better error message for failing to parse short (<30 chars?) strings.
So:
SyntaxError: undefined is not a valid JSON;
SyntaxError: "Bad string" is not a valid JSON;
SyntaxError: "[object Object]" is not a valid JSON; // Or special path for logging objects with unparsable .toString()
What do you see instead?
Syntax Error: Unexpected token o in JSON at position 1; // What?
SyntaxError: Unexpected token N in JSON at position 0; // What?
SyntaxError: Unexpected token u in JSON at position 0; // Oh, it's undefined again
--
You received this message because:
1. The project was configured to send all issue notifications to this address
You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings