From 8143a53c533bc7776c57e5db063d185bdd5750f3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 13 Dec 2020 20:26:29 +0100 Subject: patch 8.2.2141: a user command with try/catch may not catch an expression error Problem: A user command with try/catch may not catch an expression error. Solution: When an expression fails check for following "|". (closes #7469) --- src/eval.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/eval.c') diff --git a/src/eval.c b/src/eval.c index 47aaaad23..6ce2ebf68 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2158,7 +2158,10 @@ eval0( semsg(_(e_invexpr2), arg); // Some of the expression may not have been consumed. Do not check for - // a next command to avoid more errors. + // a next command to avoid more errors, unless "|" is following, which + // could only be a command separator. + if (eap != NULL && skipwhite(p)[0] == '|' && skipwhite(p)[1] != '|') + eap->nextcmd = check_nextcmd(p); return FAIL; } -- cgit v1.2.1