comparison src/channel.c @ 25088:5f6a70167daa v8.2.3081

patch 8.2.3081: cannot catch errors in a channel command Commit: https://github.com/vim/vim/commit/11a632d60bde616feb298d180108819ebb1d04a0 Author: Alisue <lambdalisue@hashnote.net> Date: Wed Jun 30 22:01:02 2021 +0200 patch 8.2.3081: cannot catch errors in a channel command Problem: Cannot catch errors in a channel command. Solution: Instead of skipping the error make it silent. (closes https://github.com/vim/vim/issues/8477)
author Bram Moolenaar <Bram@vim.org>
date Wed, 30 Jun 2021 22:15:03 +0200
parents 8f2262c72178
children 73503bafb3bf
comparison
equal deleted inserted replaced
25087:49075d646117 25088:5f6a70167daa
2543 typval_T res_tv; 2543 typval_T res_tv;
2544 typval_T err_tv; 2544 typval_T err_tv;
2545 char_u *json = NULL; 2545 char_u *json = NULL;
2546 2546
2547 // Don't pollute the display with errors. 2547 // Don't pollute the display with errors.
2548 ++emsg_skip; 2548 // Do generate the errors so that try/catch works.
2549 ++emsg_silent;
2549 if (!is_call) 2550 if (!is_call)
2550 { 2551 {
2551 ch_log(channel, "Evaluating expression '%s'", (char *)arg); 2552 ch_log(channel, "Evaluating expression '%s'", (char *)arg);
2552 tv = eval_expr(arg, NULL); 2553 tv = eval_expr(arg, NULL);
2553 } 2554 }
2579 part == PART_SOCK ? PART_SOCK : PART_IN, 2580 part == PART_SOCK ? PART_SOCK : PART_IN,
2580 json, (int)STRLEN(json), (char *)cmd); 2581 json, (int)STRLEN(json), (char *)cmd);
2581 vim_free(json); 2582 vim_free(json);
2582 } 2583 }
2583 } 2584 }
2584 --emsg_skip; 2585 --emsg_silent;
2585 if (tv == &res_tv) 2586 if (tv == &res_tv)
2586 clear_tv(tv); 2587 clear_tv(tv);
2587 else 2588 else
2588 free_tv(tv); 2589 free_tv(tv);
2589 } 2590 }