mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 03:16:31 +00:00
api_clear_error()
This commit is contained in:
@@ -411,38 +411,38 @@ static void handle_request(Channel *channel, msgpack_object *request)
|
||||
channel->id);
|
||||
call_set_error(channel, buf);
|
||||
}
|
||||
} else {
|
||||
// Retrieve the request handler
|
||||
MsgpackRpcRequestHandler handler;
|
||||
msgpack_object *method = msgpack_rpc_method(request);
|
||||
|
||||
if (method) {
|
||||
handler = msgpack_rpc_get_handler_for(method->via.bin.ptr,
|
||||
method->via.bin.size);
|
||||
} else {
|
||||
handler.fn = msgpack_rpc_handle_missing_method;
|
||||
handler.async = true;
|
||||
}
|
||||
|
||||
Array args = ARRAY_DICT_INIT;
|
||||
if (!msgpack_rpc_to_array(msgpack_rpc_args(request), &args)) {
|
||||
handler.fn = msgpack_rpc_handle_invalid_arguments;
|
||||
handler.async = true;
|
||||
}
|
||||
|
||||
RequestEvent *event_data = xmalloc(sizeof(RequestEvent));
|
||||
event_data->channel = channel;
|
||||
event_data->handler = handler;
|
||||
event_data->args = args;
|
||||
event_data->request_id = request_id;
|
||||
incref(channel);
|
||||
if (handler.async) {
|
||||
on_request_event((void **)&event_data);
|
||||
} else {
|
||||
multiqueue_put(channel->events, on_request_event, 1, event_data);
|
||||
}
|
||||
api_clear_error(&error);
|
||||
return;
|
||||
}
|
||||
// Retrieve the request handler
|
||||
MsgpackRpcRequestHandler handler;
|
||||
msgpack_object *method = msgpack_rpc_method(request);
|
||||
|
||||
if (method) {
|
||||
handler = msgpack_rpc_get_handler_for(method->via.bin.ptr,
|
||||
method->via.bin.size);
|
||||
} else {
|
||||
handler.fn = msgpack_rpc_handle_missing_method;
|
||||
handler.async = true;
|
||||
}
|
||||
|
||||
Array args = ARRAY_DICT_INIT;
|
||||
if (!msgpack_rpc_to_array(msgpack_rpc_args(request), &args)) {
|
||||
handler.fn = msgpack_rpc_handle_invalid_arguments;
|
||||
handler.async = true;
|
||||
}
|
||||
|
||||
RequestEvent *event_data = xmalloc(sizeof(RequestEvent));
|
||||
event_data->channel = channel;
|
||||
event_data->handler = handler;
|
||||
event_data->args = args;
|
||||
event_data->request_id = request_id;
|
||||
incref(channel);
|
||||
if (handler.async) {
|
||||
on_request_event((void **)&event_data);
|
||||
} else {
|
||||
multiqueue_put(channel->events, on_request_event, 1, event_data);
|
||||
}
|
||||
xfree(error.msg);
|
||||
}
|
||||
|
||||
static void on_request_event(void **argv)
|
||||
@@ -469,7 +469,7 @@ static void on_request_event(void **argv)
|
||||
api_free_array(args);
|
||||
decref(channel);
|
||||
xfree(e);
|
||||
xfree(error.msg);
|
||||
api_clear_error(&error);
|
||||
}
|
||||
|
||||
static bool channel_write(Channel *channel, WBuffer *buffer)
|
||||
@@ -518,7 +518,7 @@ static void send_error(Channel *channel, uint64_t id, char *err)
|
||||
&e,
|
||||
NIL,
|
||||
&out_buffer));
|
||||
xfree(e.msg);
|
||||
api_clear_error(&e);
|
||||
}
|
||||
|
||||
static void send_request(Channel *channel,
|
||||
|
Reference in New Issue
Block a user