forked from aniani/vim
patch 8.2.3961: error messages are spread out
Problem: Error messages are spread out. Solution: Move more errors to errors.h.
This commit is contained in:
72
src/job.c
72
src/job.c
@@ -33,7 +33,7 @@ handle_mode(typval_T *item, jobopt_T *opt, ch_mode_T *modep, int jo)
|
||||
*modep = MODE_JSON;
|
||||
else
|
||||
{
|
||||
semsg(_(e_invarg2), val);
|
||||
semsg(_(e_invalid_argument_str), val);
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
@@ -57,7 +57,7 @@ handle_io(typval_T *item, ch_part_T part, jobopt_T *opt)
|
||||
opt->jo_io[part] = JIO_OUT;
|
||||
else
|
||||
{
|
||||
semsg(_(e_invarg2), val);
|
||||
semsg(_(e_invalid_argument_str), val);
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
@@ -220,7 +220,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_io_buf[part] = tv_get_number(item);
|
||||
if (opt->jo_io_buf[part] <= 0)
|
||||
{
|
||||
semsg(_(e_invargNval), hi->hi_key, tv_get_string(item));
|
||||
semsg(_(e_invalid_value_for_argument_str_str), hi->hi_key, tv_get_string(item));
|
||||
return FAIL;
|
||||
}
|
||||
if (buflist_findnr(opt->jo_io_buf[part]) == NULL)
|
||||
@@ -270,7 +270,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
*lp = tv_get_number(item);
|
||||
if (*lp < 0)
|
||||
{
|
||||
semsg(_(e_invargNval), hi->hi_key, tv_get_string(item));
|
||||
semsg(_(e_invalid_value_for_argument_str_str), hi->hi_key, tv_get_string(item));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_set |= JO_CHANNEL;
|
||||
if (item->v_type != VAR_CHANNEL)
|
||||
{
|
||||
semsg(_(e_invargval), "channel");
|
||||
semsg(_(e_invalid_value_for_argument_str), "channel");
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_channel = item->vval.v_channel;
|
||||
@@ -294,7 +294,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_callback = get_callback(item);
|
||||
if (opt->jo_callback.cb_name == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "callback");
|
||||
semsg(_(e_invalid_value_for_argument_str), "callback");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -306,7 +306,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_out_cb = get_callback(item);
|
||||
if (opt->jo_out_cb.cb_name == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "out_cb");
|
||||
semsg(_(e_invalid_value_for_argument_str), "out_cb");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -318,7 +318,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_err_cb = get_callback(item);
|
||||
if (opt->jo_err_cb.cb_name == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "err_cb");
|
||||
semsg(_(e_invalid_value_for_argument_str), "err_cb");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_close_cb = get_callback(item);
|
||||
if (opt->jo_close_cb.cb_name == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "close_cb");
|
||||
semsg(_(e_invalid_value_for_argument_str), "close_cb");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -343,7 +343,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
never = TRUE;
|
||||
else if (STRCMP(val, "auto") != 0)
|
||||
{
|
||||
semsg(_(e_invargNval), "drop", val);
|
||||
semsg(_(e_invalid_value_for_argument_str_str), "drop", val);
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_drop_never = never;
|
||||
@@ -356,7 +356,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_exit_cb = get_callback(item);
|
||||
if (opt->jo_exit_cb.cb_name == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "exit_cb");
|
||||
semsg(_(e_invalid_value_for_argument_str), "exit_cb");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -370,7 +370,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_term_name_buf);
|
||||
if (opt->jo_term_name == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "term_name");
|
||||
semsg(_(e_invalid_value_for_argument_str), "term_name");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -381,7 +381,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
val = tv_get_string(item);
|
||||
if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0)
|
||||
{
|
||||
semsg(_(e_invargNval), "term_finish", val);
|
||||
semsg(_(e_invalid_value_for_argument_str_str), "term_finish", val);
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_set2 |= JO2_TERM_FINISH;
|
||||
@@ -406,7 +406,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
}
|
||||
if (p == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "term_opencmd");
|
||||
semsg(_(e_invalid_value_for_argument_str), "term_opencmd");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -419,7 +419,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_eof_chars_buf);
|
||||
if (opt->jo_eof_chars == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "eof_chars");
|
||||
semsg(_(e_invalid_value_for_argument_str), "eof_chars");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -435,7 +435,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
return FAIL;
|
||||
if (opt->jo_term_rows < 0 || opt->jo_term_rows > 1000)
|
||||
{
|
||||
semsg(_(e_invargval), "term_rows");
|
||||
semsg(_(e_invalid_value_for_argument_str), "term_rows");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -470,7 +470,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
nr = tv_get_number(item);
|
||||
if (nr <= 0)
|
||||
{
|
||||
semsg(_(e_invargNval), hi->hi_key, tv_get_string(item));
|
||||
semsg(_(e_invalid_value_for_argument_str_str), hi->hi_key, tv_get_string(item));
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_bufnr_buf = buflist_findnr(nr);
|
||||
@@ -482,7 +482,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
if (opt->jo_bufnr_buf->b_nwindows == 0
|
||||
|| opt->jo_bufnr_buf->b_term == NULL)
|
||||
{
|
||||
semsg(_(e_invarg2), "bufnr");
|
||||
semsg(_(e_invalid_argument_str), "bufnr");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -509,7 +509,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_term_kill_buf);
|
||||
if (opt->jo_term_kill == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "term_kill");
|
||||
semsg(_(e_invalid_value_for_argument_str), "term_kill");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -523,14 +523,14 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
p = tv_get_string_chk(item);
|
||||
if (p == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "tty_type");
|
||||
semsg(_(e_invalid_value_for_argument_str), "tty_type");
|
||||
return FAIL;
|
||||
}
|
||||
// Allow empty string, "winpty", "conpty".
|
||||
if (!(*p == NUL || STRCMP(p, "winpty") == 0
|
||||
|| STRCMP(p, "conpty") == 0))
|
||||
{
|
||||
semsg(_(e_invargval), "tty_type");
|
||||
semsg(_(e_invalid_value_for_argument_str), "tty_type");
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_tty_type = p[0];
|
||||
@@ -548,7 +548,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
if (item == NULL || item->v_type != VAR_LIST
|
||||
|| item->vval.v_list == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "ansi_colors");
|
||||
semsg(_(e_invalid_value_for_argument_str), "ansi_colors");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
|
||||
if (n != 16 || li != NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "ansi_colors");
|
||||
semsg(_(e_invalid_value_for_argument_str), "ansi_colors");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -596,7 +596,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
p = tv_get_string_buf_chk(item, opt->jo_term_highlight_buf);
|
||||
if (p == NULL || *p == NUL)
|
||||
{
|
||||
semsg(_(e_invargval), "term_highlight");
|
||||
semsg(_(e_invalid_value_for_argument_str), "term_highlight");
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_term_highlight = p;
|
||||
@@ -610,7 +610,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_term_api_buf);
|
||||
if (opt->jo_term_api == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "term_api");
|
||||
semsg(_(e_invalid_value_for_argument_str), "term_api");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -621,7 +621,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
break;
|
||||
if (item->v_type != VAR_DICT)
|
||||
{
|
||||
semsg(_(e_invargval), "env");
|
||||
semsg(_(e_invalid_value_for_argument_str), "env");
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_set2 |= JO2_ENV;
|
||||
@@ -640,7 +640,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
semsg(_(e_invargval), "cwd");
|
||||
semsg(_(e_invalid_value_for_argument_str), "cwd");
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_set2 |= JO2_CWD;
|
||||
@@ -685,7 +685,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_part = PART_OUT;
|
||||
else
|
||||
{
|
||||
semsg(_(e_invargNval), "part", val);
|
||||
semsg(_(e_invalid_value_for_argument_str_str), "part", val);
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -705,7 +705,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
opt->jo_stoponexit_buf);
|
||||
if (opt->jo_stoponexit == NULL)
|
||||
{
|
||||
semsg(_(e_invargval), "stoponexit");
|
||||
semsg(_(e_invalid_value_for_argument_str), "stoponexit");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -722,7 +722,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
}
|
||||
if (todo > 0)
|
||||
{
|
||||
semsg(_(e_invarg2), hi->hi_key);
|
||||
semsg(_(e_invalid_argument_str), hi->hi_key);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -1385,7 +1385,7 @@ job_start(
|
||||
cmd = argvars[0].vval.v_string;
|
||||
if (cmd == NULL || *skipwhite(cmd) == NUL)
|
||||
{
|
||||
emsg(_(e_invarg));
|
||||
emsg(_(e_invalid_argument));
|
||||
goto theend;
|
||||
}
|
||||
|
||||
@@ -1396,7 +1396,7 @@ job_start(
|
||||
|| argvars[0].vval.v_list == NULL
|
||||
|| argvars[0].vval.v_list->lv_len < 1)
|
||||
{
|
||||
emsg(_(e_invarg));
|
||||
emsg(_(e_invalid_argument));
|
||||
goto theend;
|
||||
}
|
||||
else
|
||||
@@ -1409,7 +1409,7 @@ job_start(
|
||||
// Empty command is invalid.
|
||||
if (argc == 0 || *skipwhite((char_u *)argv[0]) == NUL)
|
||||
{
|
||||
emsg(_(e_invarg));
|
||||
emsg(_(e_invalid_argument));
|
||||
goto theend;
|
||||
}
|
||||
#ifndef USE_ARGV
|
||||
@@ -1418,7 +1418,7 @@ job_start(
|
||||
cmd = ga.ga_data;
|
||||
if (cmd == NULL || *skipwhite(cmd) == NUL)
|
||||
{
|
||||
emsg(_(e_invarg));
|
||||
emsg(_(e_invalid_argument));
|
||||
goto theend;
|
||||
}
|
||||
#endif
|
||||
@@ -1512,7 +1512,7 @@ job_stop(job_T *job, typval_T *argvars, char *type)
|
||||
arg = tv_get_string_chk(&argvars[1]);
|
||||
if (arg == NULL)
|
||||
{
|
||||
emsg(_(e_invarg));
|
||||
emsg(_(e_invalid_argument));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1775,7 +1775,7 @@ get_job_arg(typval_T *tv)
|
||||
|
||||
if (tv->v_type != VAR_JOB)
|
||||
{
|
||||
semsg(_(e_invarg2), tv_get_string(tv));
|
||||
semsg(_(e_invalid_argument_str), tv_get_string(tv));
|
||||
return NULL;
|
||||
}
|
||||
job = tv->vval.v_job;
|
||||
|
||||
Reference in New Issue
Block a user