fix(messages): incorrect error message splitting and kind #32990

Problem:  Message kind logic for emitting an error message is convoluted
          and still results in emitting an unfinished message earlier than
          wanted.
Solution: Ensure emsg_multiline() always sets the kind wanted by the caller
          and doesn't isn't unset to logic for emitting the source message.
          Caller is responsible for making sure multiple message chunks are
          not emitted as multiple events by setting `msg_ext_skip_flush`...
This commit is contained in:
luukvbaal
2025-03-19 19:04:08 +01:00
committed by GitHub
parent c48cf18752
commit 51853b82bc
9 changed files with 29 additions and 39 deletions

View File

@@ -368,7 +368,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
Object result = handler.fn(VIML_INTERNAL_CALL, args, &arena, &err);
if (ERROR_SET(&err)) {
semsg_multiline(e_api_error, err.msg);
semsg_multiline("emsg", e_api_error, err.msg);
goto end;
}
@@ -6414,12 +6414,11 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (chan) {
name = get_client_info(chan, "name");
}
msg_ext_set_kind("rpc_error");
if (name) {
semsg_multiline("Error invoking '%s' on channel %" PRIu64 " (%s):\n%s",
semsg_multiline("rpc_error", "Error invoking '%s' on channel %" PRIu64 " (%s):\n%s",
method, chan_id, name, err.msg);
} else {
semsg_multiline("Error invoking '%s' on channel %" PRIu64 ":\n%s",
semsg_multiline("rpc_error", "Error invoking '%s' on channel %" PRIu64 ":\n%s",
method, chan_id, err.msg);
}