Bug 178216
| Summary: | ES6 Modules: Syntax, binding errors don't provide source file or line number | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Richard Connamacher <richardconnamacher> |
| Component: | JavaScriptCore | Assignee: | Yusuke Suzuki <ysuzuki> |
| Status: | NEW | ||
| Severity: | Normal | CC: | webkit-bug-importer, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 11 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Richard Connamacher
When an ES6 module (loaded via an import statement) contains a syntax error or error in resolving an "import" statement, the error message printed to the Console is unhelpful.
Specifically, it doesn't say which file or line number had the error, and the stack trace simply lists the native "promiseReactionJob".
// main.js:
import {foo} from "./foo.js"
// foo.js:
syntax error!
export const foo = "Foo";
// Console message:
SyntaxError: Unexpected identifier 'error'
promiseReactionJob
In a traditional script, the syntax error would also indicate the source file (foo.js) and line number (1).
This also happens when an "import" is invalid, such as a missing binding:
// main.js:
import {bar} from "./foo.js"
// foo.js:
export const foo = "Foo";
// Console message:
SyntaxError: Importing binding name 'bar' is not found.
link
linkAndEvaluateModule
(anonymous function)
promiseReactionJob
As well as if the URL can't be loaded:
// main.js
import {foo} from "./missing.js";
// Console message:
Failed to load resource: the requested URL was not found on the server <url>/missing.js
(Would help if it also said which source file had the failed import statement.)
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/34969296>