mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 11:26:37 +00:00
Merge pull request #20945 from erw7/feat-more-exception-info
feat(api): show more exception info
This commit is contained in:
@@ -150,7 +150,18 @@ bool try_end(Error *err)
|
||||
xfree(msg);
|
||||
}
|
||||
} else if (did_throw) {
|
||||
api_set_error(err, kErrorTypeException, "%s", current_exception->value);
|
||||
if (*current_exception->throw_name != NUL) {
|
||||
if (current_exception->throw_lnum != 0) {
|
||||
api_set_error(err, kErrorTypeException, "%s, line %" PRIdLINENR ": %s",
|
||||
current_exception->throw_name, current_exception->throw_lnum,
|
||||
current_exception->value);
|
||||
} else {
|
||||
api_set_error(err, kErrorTypeException, "%s: %s",
|
||||
current_exception->throw_name, current_exception->value);
|
||||
}
|
||||
} else {
|
||||
api_set_error(err, kErrorTypeException, "%s", current_exception->value);
|
||||
}
|
||||
discard_current_exception();
|
||||
}
|
||||
|
||||
|
@@ -773,7 +773,8 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool clea
|
||||
tl_ret = try_leave(&tstate, &err);
|
||||
if (!tl_ret && ERROR_SET(&err)) {
|
||||
msg_putchar('\n');
|
||||
msg_printf_attr(HL_ATTR(HLF_E)|MSG_HIST, (char *)e_autocmd_err, err.msg);
|
||||
msg_scroll = true;
|
||||
msg_puts_attr(err.msg, HL_ATTR(HLF_E)|MSG_HIST);
|
||||
api_clear_error(&err);
|
||||
redrawcmd();
|
||||
}
|
||||
@@ -881,7 +882,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool clea
|
||||
|
||||
if (!tl_ret && ERROR_SET(&err)) {
|
||||
msg_putchar('\n');
|
||||
semsg(e_autocmd_err, err.msg);
|
||||
emsg(err.msg);
|
||||
did_emsg = false;
|
||||
api_clear_error(&err);
|
||||
}
|
||||
@@ -2544,7 +2545,8 @@ static void do_autocmd_cmdlinechanged(int firstc)
|
||||
bool tl_ret = try_leave(&tstate, &err);
|
||||
if (!tl_ret && ERROR_SET(&err)) {
|
||||
msg_putchar('\n');
|
||||
msg_printf_attr(HL_ATTR(HLF_E)|MSG_HIST, (char *)e_autocmd_err, err.msg);
|
||||
msg_scroll = true;
|
||||
msg_puts_attr(err.msg, HL_ATTR(HLF_E)|MSG_HIST);
|
||||
api_clear_error(&err);
|
||||
redrawcmd();
|
||||
}
|
||||
|
@@ -1002,7 +1002,6 @@ EXTERN char e_fnametoolong[] INIT(= N_("E856: Filename too long"));
|
||||
EXTERN char e_float_as_string[] INIT(= N_("E806: using Float as a String"));
|
||||
EXTERN char e_cannot_edit_other_buf[] INIT(= N_("E788: Not allowed to edit another buffer now"));
|
||||
|
||||
EXTERN char e_autocmd_err[] INIT(= N_("E5500: autocmd has thrown an exception: %s"));
|
||||
EXTERN char e_cmdmap_err[] INIT(= N_("E5520: <Cmd> mapping must end with <CR>"));
|
||||
EXTERN char e_cmdmap_repeated[]
|
||||
INIT(= N_("E5521: <Cmd> mapping must end with <CR> before second <Cmd>"));
|
||||
|
Reference in New Issue
Block a user