]> granicus.if.org Git - vim/commitdiff
patch 8.2.3081: cannot catch errors in a channel command v8.2.3081
authorAlisue <lambdalisue@hashnote.net>
Wed, 30 Jun 2021 20:01:02 +0000 (22:01 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 30 Jun 2021 20:01:02 +0000 (22:01 +0200)
Problem:    Cannot catch errors in a channel command.
Solution:   Instead of skipping the error make it silent. (closes #8477)

src/channel.c
src/version.c

index 5818dc399bea95d3c47e66b4d33e1c7b8be1dac6..5d89413503fc8f7d1a5375298544ada245dc4c4f 100644 (file)
@@ -2545,7 +2545,8 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv)
            char_u      *json = NULL;
 
            // Don't pollute the display with errors.
-           ++emsg_skip;
+           // Do generate the errors so that try/catch works.
+           ++emsg_silent;
            if (!is_call)
            {
                ch_log(channel, "Evaluating expression '%s'", (char *)arg);
@@ -2581,7 +2582,7 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv)
                    vim_free(json);
                }
            }
-           --emsg_skip;
+           --emsg_silent;
            if (tv == &res_tv)
                clear_tv(tv);
            else
index ed97a521b8ef32cf7d7defee24afb886ed654dc0..e3bdedefbdec1f25d19d7b54dcc0e3ff14abaaa0 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3081,
 /**/
     3080,
 /**/