Thanks Yang, I didn't realize that filing an issue is the preferred way of dealing with this. In hindsight that seems obvious. Will do in the future should anything else come up.
On Sunday, February 7, 2016 at 11:35:39 PM UTC-8, Yang Guo wrote: > > Hi, > > this feature request sounds reasonable. Though you probably should have > filed an issue to the issue tracker instead. I created a patch for this > https://codereview.chromium.org/1681513002. > > Cheers, > > Yang > > On Monday, February 8, 2016 at 7:32:32 AM UTC+1, Alex Kodat wrote: >> >> Would it make sense to have JSON.parse exception messages be changed from >> something like: >> >> SyntaxError: Unexpected token x >> >> to something like: >> >> SyntaxError: JSON.parse: Unexpected token x at offset 46 of JSON data >> >> ? While https://codereview.chromium.org/1308123006/ helped out if one is >> using the Chrome Debugger (I'm guessing), it's not so helpful when the >> problem occurs for an end-user and it doesn't really provide a nice way to >> programatically capture useful information. >> >> FWIW, FireFox/SpiderMonkey report JSON.parse errors like: >> >> SyntaxError: JSON.parse: bad escaped character at line 3 column 5 of the >> JSON data >> >> Don't know if line/column offers much more value than offset (it's easy >> enough to go from one to the other) but just noticed this issue when we had >> to resort to using FireFox to diagnose a problem with bad JSON data (the >> bad data was in the middle of >20,000 bytes). >> >> If this sounds reasonable, I'd be happy to submit a project to do so as I >> already have the trivial update working locally. Maybe it even makes sense >> to add the offset (or line/column) as an exception property as that would >> make it even easier to deal with JSON.parse errors programatically but >> maybe that crosses some philosophical boundary. >> >> And I know I can write (because I have written) a C++ function that calls >> JSON.parse or a function that calls JSON.parse with a TryCatch active and >> grabs the info from the Message but that doesn't help for browsers and it >> just seems a little unfriendly of JSON.parse to not provide this >> information. >> >> Thanks >> >> -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.