Mercurial > vim
diff src/channel.c @ 29994:86eb4aba16c3 v9.0.0335
patch 9.0.0335: checks for Dictionary argument often give a vague error
Commit: https://github.com/vim/vim/commit/04c4c5746e15884768d2cb41370c3276a196cd4c
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Aug 30 19:48:24 2022 +0100
patch 9.0.0335: checks for Dictionary argument often give a vague error
Problem: Checks for Dictionary argument often give a vague error message.
Solution: Give a useful error message. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11009)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Aug 2022 21:00:05 +0200 |
parents | 89e1d67814a9 |
children | d269dd3cd31d |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -1392,11 +1392,8 @@ channel_open_func(typval_T *argvars) address = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN - && (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL)) - { - emsg(_(e_invalid_argument)); + && check_for_nonnull_dict_arg(argvars, 1) == FAIL) return NULL; - } if (*address == NUL) { @@ -4601,11 +4598,9 @@ ch_expr_common(typval_T *argvars, typval if (rettv_dict_alloc(rettv) == FAIL) return; - if (argvars[1].v_type != VAR_DICT) - { - semsg(_(e_dict_required_for_argument_nr), 2); + if (check_for_dict_arg(argvars, 1) == FAIL) return; - } + d = argvars[1].vval.v_dict; di = dict_find(d, (char_u *)"id", -1); if (di != NULL && di->di_tv.v_type != VAR_NUMBER)