Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: recoverable handling
  • Loading branch information
guybedford committed Jun 30, 2021
commit 96781d683e1fa7b652ae79ac543a09291811bb35
3 changes: 3 additions & 0 deletions lib/internal/repl/await.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const {

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

const noop = FunctionPrototype;
const visitorsWithoutAncestors = {
Expand Down Expand Up @@ -94,6 +95,8 @@ function processTopLevelAwait(src) {
try {
root = parser.parse(wrapped, { ecmaVersion: 'latest' });
} catch (e) {
if (e.message.startsWith('Unterminated '))
Comment thread
guybedford marked this conversation as resolved.
Outdated
throw new Recoverable(e);
// If the parse error is before the first "await", then use the execution
// error. Otherwise we must emit this parse error, making it look like a
// proper syntax error.
Expand Down