Bug 25630 - JavaScript console doesn't provide useful error messages for syntax errors
Summary: JavaScript console doesn't provide useful error messages for syntax errors
Status: RESOLVED DUPLICATE of bug 62613
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2009-05-07 14:00 PDT by boucher
Modified: 2011-08-07 23:42 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description boucher 2009-05-07 14:00:16 PDT
Steps to reproduce: 

1. Load any page with invalid JavaScript code.
2. Open the Web Inspector
3. You should see the error string "SyntaxError: Parse error"

This error string is not useful, and provides no context about either the location of the parse error, or the kind of error. Try loading the same file in Firefox with Firebug and you'll get a very descriptive error, like the following:

missing ; before statement
    "some code from the line following the error would be shown here";
Comment 1 Mark Rowe (bdash) 2009-05-07 14:37:21 PDT
The error message is rather generic, but there *is* context about the location of the error.  As with other exceptions logged in the console, the file name and line number are given to the right of the exception message and can be clicked to reveal the relevant part of the source.
Comment 2 Mark Rowe (bdash) 2009-05-07 14:37:52 PDT
<rdar://problem/6867110>
Comment 3 boucher 2009-05-07 14:44:48 PDT
Fair point. I didn't notice because the line number info isn't useful with eval'd code (it gives the location of the eval, rather than the location of the line within the eval, which is why the firebug error was more relevant, since it gives you the following line of code)
Comment 4 Mark Rowe (bdash) 2009-05-07 18:22:37 PDT
Ok, so it seems like there are two separate issues to address:
1) Giving more specific errors than "parse error"
2) Providing a link to context in eval'd source

We should use this bug to track the former as it's a JavaScriptCore issue, and file a new bug about the second which is likely to primarily be a web inspector issue.
Comment 5 Gavin Barraclough 2011-08-07 23:42:12 PDT

*** This bug has been marked as a duplicate of bug 62613 ***