Skip to content

Commit 96781d6

Browse files
committed
fixup: recoverable handling
1 parent 0cb7f22 commit 96781d6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/internal/repl/await.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const {
1919

2020
const parser = require('internal/deps/acorn/acorn/dist/acorn').Parser;
2121
const walk = require('internal/deps/acorn/acorn-walk/dist/walk');
22+
const { Recoverable } = require('internal/repl');
2223

2324
const noop = FunctionPrototype;
2425
const visitorsWithoutAncestors = {
@@ -94,6 +95,8 @@ function processTopLevelAwait(src) {
9495
try {
9596
root = parser.parse(wrapped, { ecmaVersion: 'latest' });
9697
} catch (e) {
98+
if (e.message.startsWith('Unterminated '))
99+
throw new Recoverable(e);
97100
// If the parse error is before the first "await", then use the execution
98101
// error. Otherwise we must emit this parse error, making it look like a
99102
// proper syntax error.

0 commit comments

Comments
 (0)