Skip to content

Commit b3292fa

Browse files
committed
patch 8.0.1516: errors for job options are not very specific
Problem: Errors for job options are not very specific. Solution: Add more specific error messages.
1 parent ab5e7c3 commit b3292fa

3 files changed

Lines changed: 21 additions & 17 deletions

File tree

src/channel.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4458,7 +4458,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
44584458
return OK;
44594459
if (tv->v_type != VAR_DICT)
44604460
{
4461-
EMSG(_(e_invarg));
4461+
EMSG(_(e_dictreq));
44624462
return FAIL;
44634463
}
44644464
dict = tv->vval.v_dict;
@@ -4541,7 +4541,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
45414541
opt->jo_io_buf[part] = get_tv_number(item);
45424542
if (opt->jo_io_buf[part] <= 0)
45434543
{
4544-
EMSG2(_(e_invarg2), get_tv_string(item));
4544+
EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item));
45454545
return FAIL;
45464546
}
45474547
if (buflist_findnr(opt->jo_io_buf[part]) == NULL)
@@ -4590,7 +4590,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
45904590
*lp = get_tv_number(item);
45914591
if (*lp < 0)
45924592
{
4593-
EMSG2(_(e_invarg2), get_tv_string(item));
4593+
EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item));
45944594
return FAIL;
45954595
}
45964596
}
@@ -4601,7 +4601,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46014601
opt->jo_set |= JO_CHANNEL;
46024602
if (item->v_type != VAR_CHANNEL)
46034603
{
4604-
EMSG2(_(e_invarg2), "channel");
4604+
EMSG2(_(e_invargval), "channel");
46054605
return FAIL;
46064606
}
46074607
opt->jo_channel = item->vval.v_channel;
@@ -4614,7 +4614,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46144614
opt->jo_callback = get_callback(item, &opt->jo_partial);
46154615
if (opt->jo_callback == NULL)
46164616
{
4617-
EMSG2(_(e_invarg2), "callback");
4617+
EMSG2(_(e_invargval), "callback");
46184618
return FAIL;
46194619
}
46204620
}
@@ -4626,7 +4626,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46264626
opt->jo_out_cb = get_callback(item, &opt->jo_out_partial);
46274627
if (opt->jo_out_cb == NULL)
46284628
{
4629-
EMSG2(_(e_invarg2), "out_cb");
4629+
EMSG2(_(e_invargval), "out_cb");
46304630
return FAIL;
46314631
}
46324632
}
@@ -4638,7 +4638,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46384638
opt->jo_err_cb = get_callback(item, &opt->jo_err_partial);
46394639
if (opt->jo_err_cb == NULL)
46404640
{
4641-
EMSG2(_(e_invarg2), "err_cb");
4641+
EMSG2(_(e_invargval), "err_cb");
46424642
return FAIL;
46434643
}
46444644
}
@@ -4650,7 +4650,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46504650
opt->jo_close_cb = get_callback(item, &opt->jo_close_partial);
46514651
if (opt->jo_close_cb == NULL)
46524652
{
4653-
EMSG2(_(e_invarg2), "close_cb");
4653+
EMSG2(_(e_invargval), "close_cb");
46544654
return FAIL;
46554655
}
46564656
}
@@ -4663,7 +4663,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46634663
never = TRUE;
46644664
else if (STRCMP(val, "auto") != 0)
46654665
{
4666-
EMSG2(_(e_invarg2), "drop");
4666+
EMSG3(_(e_invargNval), "drop", val);
46674667
return FAIL;
46684668
}
46694669
opt->jo_drop_never = never;
@@ -4676,7 +4676,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46764676
opt->jo_exit_cb = get_callback(item, &opt->jo_exit_partial);
46774677
if (opt->jo_exit_cb == NULL)
46784678
{
4679-
EMSG2(_(e_invarg2), "exit_cb");
4679+
EMSG2(_(e_invargval), "exit_cb");
46804680
return FAIL;
46814681
}
46824682
}
@@ -4689,7 +4689,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
46894689
opt->jo_term_name = get_tv_string_chk(item);
46904690
if (opt->jo_term_name == NULL)
46914691
{
4692-
EMSG2(_(e_invarg2), "term_name");
4692+
EMSG2(_(e_invargval), "term_name");
46934693
return FAIL;
46944694
}
46954695
}
@@ -4700,7 +4700,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
47004700
val = get_tv_string(item);
47014701
if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0)
47024702
{
4703-
EMSG2(_(e_invarg2), val);
4703+
EMSG3(_(e_invargNval), "term_finish", val);
47044704
return FAIL;
47054705
}
47064706
opt->jo_set2 |= JO2_TERM_FINISH;
@@ -4724,7 +4724,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
47244724
}
47254725
if (p == NULL)
47264726
{
4727-
EMSG2(_(e_invarg2), "term_opencmd");
4727+
EMSG2(_(e_invargval), "term_opencmd");
47284728
return FAIL;
47294729
}
47304730
}
@@ -4738,7 +4738,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
47384738
p = opt->jo_eof_chars = get_tv_string_chk(item);
47394739
if (p == NULL)
47404740
{
4741-
EMSG2(_(e_invarg2), "term_opencmd");
4741+
EMSG2(_(e_invargval), "eof_chars");
47424742
return FAIL;
47434743
}
47444744
}
@@ -4793,7 +4793,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
47934793
opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf);
47944794
if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd))
47954795
{
4796-
EMSG2(_(e_invarg2), "cwd");
4796+
EMSG2(_(e_invargval), "cwd");
47974797
return FAIL;
47984798
}
47994799
opt->jo_set |= JO2_CWD;
@@ -4838,7 +4838,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
48384838
opt->jo_part = PART_OUT;
48394839
else
48404840
{
4841-
EMSG2(_(e_invarg2), val);
4841+
EMSG3(_(e_invargNval), "part", val);
48424842
return FAIL;
48434843
}
48444844
}
@@ -4858,7 +4858,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
48584858
opt->jo_soe_buf);
48594859
if (opt->jo_stoponexit == NULL)
48604860
{
4861-
EMSG2(_(e_invarg2), "stoponexit");
4861+
EMSG2(_(e_invargval), "stoponexit");
48624862
return FAIL;
48634863
}
48644864
}

src/globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,8 @@ EXTERN char_u e_interr[] INIT(= N_("Interrupted"));
14371437
EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address"));
14381438
EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument"));
14391439
EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
1440+
EXTERN char_u e_invargval[] INIT(= N_("E475: Invalid value for argument %s"));
1441+
EXTERN char_u e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"));
14401442
#ifdef FEAT_EVAL
14411443
EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
14421444
#endif

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ static char *(features[]) =
771771

772772
static int included_patches[] =
773773
{ /* Add new patch number below this line */
774+
/**/
775+
1516,
774776
/**/
775777
1515,
776778
/**/

0 commit comments

Comments
 (0)