summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-04-12 12:45:36 +0100
committerGitHub <noreply@github.com>2023-04-12 13:45:36 +0200
commit806671af3345f403d122911d8a3f09a2994bb8c0 (patch)
tree28520c1d8017b85444317959de8dab96ee5bee04 /runtime/worker.rs
parent18e0ee368c6a77b476f3fec7574415465f9052b9 (diff)
fix(core): preserve syntax error locations in dynamic imports (#18664)
Fixes #6259. Adds the location for v8 syntax errors to the message (`message += " at {location}"`) when rethrowing them for dynamic imports. Discussing with @bartlomieju on discord I proposed just preserving v8's error and not reconstructing it, allowing the standard stack trace to just point to the syntax error instead of the dynamic import. But on further thought this way has parity with SWC's syntax errors + has the advantage of showing both the syntax error and dynamic import location. ```ts // temp.js await import("./temp2.js"); // temp2.js function foo() { await Promise.resolve(); } // Before: // error: Uncaught (in promise) SyntaxError: Unexpected reserved word // await import("./temp2.js"); // ^ // at async file:///.../temp.js:1:1 // After: // error: Uncaught (in promise) SyntaxError: Unexpected reserved word at file:///.../temp2.js:2:3 // await import("./temp2.js"); // ^ // at async file:///.../temp.js:1:1 ```
Diffstat (limited to 'runtime/worker.rs')
0 files changed, 0 insertions, 0 deletions