diff --git a/src/wast-parser.cc b/src/wast-parser.cc index 23595d9b31..e5a6f6dffc 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -2794,6 +2794,7 @@ Result WastParser::ParseExpr(ExprList* exprs) { break; } default: + ErrorExpected({"catch", "catch_all", "unwind", "delegate"}); break; } } diff --git a/test/parse/expr/bad-try-clause.txt b/test/parse/expr/bad-try-clause.txt new file mode 100644 index 0000000000..d5f3eb7c6c --- /dev/null +++ b/test/parse/expr/bad-try-clause.txt @@ -0,0 +1,10 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +;;; ERROR: 1 +(module + (func (try (do) (foo))) +(;; STDERR ;;; +out/test/parse/expr/bad-try-clause.txt:5:20: error: unexpected token "foo", expected catch, catch_all, unwind or delegate. + (func (try (do) (foo))) + ^^^ +;;; STDERR ;;)