Commit e9e3ae2
fix(browser): report the caller's line and column for browser-run compile errors
A program that fails to compile was surfaced as
"QuickJS promise rejected: invalid number literal" with no position, because
new AsyncFunction(source) runs inside the promise and its SyntaxError carried
lineNumber/columnNumber that were then discarded. The prefix pointed at async
plumbing rather than the program, so readers hunted heredocs and await instead
of the actual defect: an unescaped quote in a string literal holding a URL.
Compile the program before racing it, and turn a compile failure into a
BROWSER_RUN_SYNTAX_ERROR carrying the caller's own line and column (the
AsyncFunction wrapper adds two lines, so subtract them), a windowed excerpt
with a caret, and a hint naming the quoting cause. Errors that already carry a
BROWSER_RUN_ code keep their message instead of gaining a host stage prefix.
runner.test.ts imported MemorySnapshotBaselineStore twice, so the file failed
to load and its 74 tests never ran; the duplicate is removed here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent ad17a0c commit e9e3ae2
3 files changed
Lines changed: 46 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
604 | 607 | | |
605 | 608 | | |
606 | 609 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
232 | 231 | | |
233 | 232 | | |
234 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
235 | 247 | | |
236 | 248 | | |
237 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
492 | 515 | | |
493 | 516 | | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
494 | 523 | | |
495 | 524 | | |
496 | 525 | | |
497 | 526 | | |
498 | 527 | | |
499 | | - | |
| 528 | + | |
500 | 529 | | |
501 | 530 | | |
502 | 531 | | |
| |||
0 commit comments