mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
api_set_error(): rename
This commit is contained in:
@@ -475,7 +475,7 @@ Object msgpack_rpc_handle_missing_method(uint64_t channel_id,
|
||||
Array args,
|
||||
Error *error)
|
||||
{
|
||||
_api_set_error(error, kErrorTypeException, "Invalid method name");
|
||||
api_set_error(error, kErrorTypeException, "Invalid method name");
|
||||
return NIL;
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ Object msgpack_rpc_handle_invalid_arguments(uint64_t channel_id,
|
||||
Array args,
|
||||
Error *error)
|
||||
{
|
||||
_api_set_error(error, kErrorTypeException, "Invalid method arguments");
|
||||
api_set_error(error, kErrorTypeException, "Invalid method arguments");
|
||||
return NIL;
|
||||
}
|
||||
|
||||
@@ -570,29 +570,29 @@ void msgpack_rpc_validate(uint64_t *response_id,
|
||||
*response_id = NO_RESPONSE;
|
||||
// Validate the basic structure of the msgpack-rpc payload
|
||||
if (req->type != MSGPACK_OBJECT_ARRAY) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Message is not an array"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Message is not an array"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (req->via.array.size == 0) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Message is empty"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Message is empty"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (req->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Message type must be an integer"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Message type must be an integer"));
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t type = req->via.array.ptr[0].via.u64;
|
||||
if (type != kMessageTypeRequest && type != kMessageTypeNotification) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Unknown message type"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Unknown message type"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((type == kMessageTypeRequest && req->via.array.size != 4)
|
||||
|| (type == kMessageTypeNotification && req->via.array.size != 3)) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) "
|
||||
api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) "
|
||||
"or 3 (notification)"));
|
||||
return;
|
||||
}
|
||||
@@ -600,19 +600,19 @@ void msgpack_rpc_validate(uint64_t *response_id,
|
||||
if (type == kMessageTypeRequest) {
|
||||
msgpack_object *id_obj = msgpack_rpc_msg_id(req);
|
||||
if (!id_obj) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer"));
|
||||
api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer"));
|
||||
return;
|
||||
}
|
||||
*response_id = id_obj->via.u64;
|
||||
}
|
||||
|
||||
if (!msgpack_rpc_method(req)) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Method must be a string"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Method must be a string"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!msgpack_rpc_args(req)) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Parameters must be an array"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Parameters must be an array"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user