changeset 13284:a69636c63103 v8.0.1516

patch 8.0.1516: errors for job options are not very specific commit https://github.com/vim/vim/commit/b3292fa2d362b064ff8a115fc0ad794c1f1265d7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 13 15:17:58 2018 +0100 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.
author Christian Brabandt <cb@256bit.org>
date Tue, 13 Feb 2018 15:30:07 +0100
parents 9fa6ae3de9ed
children 546b2a354d13
files src/channel.c src/globals.h src/version.c
diffstat 3 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -4458,7 +4458,7 @@ get_job_options(typval_T *tv, jobopt_T *
 	return OK;
     if (tv->v_type != VAR_DICT)
     {
-	EMSG(_(e_invarg));
+	EMSG(_(e_dictreq));
 	return FAIL;
     }
     dict = tv->vval.v_dict;
@@ -4541,7 +4541,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_io_buf[part] = get_tv_number(item);
 		if (opt->jo_io_buf[part] <= 0)
 		{
-		    EMSG2(_(e_invarg2), get_tv_string(item));
+		    EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item));
 		    return FAIL;
 		}
 		if (buflist_findnr(opt->jo_io_buf[part]) == NULL)
@@ -4590,7 +4590,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		*lp = get_tv_number(item);
 		if (*lp < 0)
 		{
-		    EMSG2(_(e_invarg2), get_tv_string(item));
+		    EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item));
 		    return FAIL;
 		}
 	    }
@@ -4601,7 +4601,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_set |= JO_CHANNEL;
 		if (item->v_type != VAR_CHANNEL)
 		{
-		    EMSG2(_(e_invarg2), "channel");
+		    EMSG2(_(e_invargval), "channel");
 		    return FAIL;
 		}
 		opt->jo_channel = item->vval.v_channel;
@@ -4614,7 +4614,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_callback = get_callback(item, &opt->jo_partial);
 		if (opt->jo_callback == NULL)
 		{
-		    EMSG2(_(e_invarg2), "callback");
+		    EMSG2(_(e_invargval), "callback");
 		    return FAIL;
 		}
 	    }
@@ -4626,7 +4626,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_out_cb = get_callback(item, &opt->jo_out_partial);
 		if (opt->jo_out_cb == NULL)
 		{
-		    EMSG2(_(e_invarg2), "out_cb");
+		    EMSG2(_(e_invargval), "out_cb");
 		    return FAIL;
 		}
 	    }
@@ -4638,7 +4638,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_err_cb = get_callback(item, &opt->jo_err_partial);
 		if (opt->jo_err_cb == NULL)
 		{
-		    EMSG2(_(e_invarg2), "err_cb");
+		    EMSG2(_(e_invargval), "err_cb");
 		    return FAIL;
 		}
 	    }
@@ -4650,7 +4650,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_close_cb = get_callback(item, &opt->jo_close_partial);
 		if (opt->jo_close_cb == NULL)
 		{
-		    EMSG2(_(e_invarg2), "close_cb");
+		    EMSG2(_(e_invargval), "close_cb");
 		    return FAIL;
 		}
 	    }
@@ -4663,7 +4663,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		    never = TRUE;
 		else if (STRCMP(val, "auto") != 0)
 		{
-		    EMSG2(_(e_invarg2), "drop");
+		    EMSG3(_(e_invargNval), "drop", val);
 		    return FAIL;
 		}
 		opt->jo_drop_never = never;
@@ -4676,7 +4676,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_exit_cb = get_callback(item, &opt->jo_exit_partial);
 		if (opt->jo_exit_cb == NULL)
 		{
-		    EMSG2(_(e_invarg2), "exit_cb");
+		    EMSG2(_(e_invargval), "exit_cb");
 		    return FAIL;
 		}
 	    }
@@ -4689,7 +4689,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_term_name = get_tv_string_chk(item);
 		if (opt->jo_term_name == NULL)
 		{
-		    EMSG2(_(e_invarg2), "term_name");
+		    EMSG2(_(e_invargval), "term_name");
 		    return FAIL;
 		}
 	    }
@@ -4700,7 +4700,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		val = get_tv_string(item);
 		if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0)
 		{
-		    EMSG2(_(e_invarg2), val);
+		    EMSG3(_(e_invargNval), "term_finish", val);
 		    return FAIL;
 		}
 		opt->jo_set2 |= JO2_TERM_FINISH;
@@ -4724,7 +4724,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		}
 		if (p == NULL)
 		{
-		    EMSG2(_(e_invarg2), "term_opencmd");
+		    EMSG2(_(e_invargval), "term_opencmd");
 		    return FAIL;
 		}
 	    }
@@ -4738,7 +4738,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		p = opt->jo_eof_chars = get_tv_string_chk(item);
 		if (p == NULL)
 		{
-		    EMSG2(_(e_invarg2), "term_opencmd");
+		    EMSG2(_(e_invargval), "eof_chars");
 		    return FAIL;
 		}
 	    }
@@ -4793,7 +4793,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf);
 		if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd))
 		{
-		    EMSG2(_(e_invarg2), "cwd");
+		    EMSG2(_(e_invargval), "cwd");
 		    return FAIL;
 		}
 		opt->jo_set |= JO2_CWD;
@@ -4838,7 +4838,7 @@ get_job_options(typval_T *tv, jobopt_T *
 		    opt->jo_part = PART_OUT;
 		else
 		{
-		    EMSG2(_(e_invarg2), val);
+		    EMSG3(_(e_invargNval), "part", val);
 		    return FAIL;
 		}
 	    }
@@ -4858,7 +4858,7 @@ get_job_options(typval_T *tv, jobopt_T *
 							     opt->jo_soe_buf);
 		if (opt->jo_stoponexit == NULL)
 		{
-		    EMSG2(_(e_invarg2), "stoponexit");
+		    EMSG2(_(e_invargval), "stoponexit");
 		    return FAIL;
 		}
 	    }
--- a/src/globals.h
+++ b/src/globals.h
@@ -1437,6 +1437,8 @@ EXTERN char_u e_interr[]	INIT(= N_("Inte
 EXTERN char_u e_invaddr[]	INIT(= N_("E14: Invalid address"));
 EXTERN char_u e_invarg[]	INIT(= N_("E474: Invalid argument"));
 EXTERN char_u e_invarg2[]	INIT(= N_("E475: Invalid argument: %s"));
+EXTERN char_u e_invargval[]	INIT(= N_("E475: Invalid value for argument %s"));
+EXTERN char_u e_invargNval[]	INIT(= N_("E475: Invalid value for argument %s: %s"));
 #ifdef FEAT_EVAL
 EXTERN char_u e_invexpr2[]	INIT(= N_("E15: Invalid expression: %s"));
 #endif
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1516,
+/**/
     1515,
 /**/
     1514,