ctl-server: Improve error messages for missing arguments

srht-ci
Andri Yngvason 2023-01-15 17:53:34 +00:00
parent 0b970ba355
commit f49aea40a4
1 changed files with 2 additions and 4 deletions

View File

@ -138,8 +138,7 @@ static struct cmd_set_output* cmd_set_output_new(json_t* args,
{ {
const char* target = NULL; const char* target = NULL;
if (json_unpack(args, "{s:s}", "output-name", &target) == -1) { if (json_unpack(args, "{s:s}", "output-name", &target) == -1) {
jsonipc_error_printf(err, EINVAL, jsonipc_error_printf(err, EINVAL, "Missing output name");
"required: \"output-name\"");
return NULL; return NULL;
} }
struct cmd_set_output* cmd = calloc(1, sizeof(*cmd)); struct cmd_set_output* cmd = calloc(1, sizeof(*cmd));
@ -152,8 +151,7 @@ static struct cmd_disconnect_client* cmd_disconnect_client_new(json_t* args,
{ {
const char* id = NULL; const char* id = NULL;
if (json_unpack(args, "{s:s}", "id", &id) == -1) { if (json_unpack(args, "{s:s}", "id", &id) == -1) {
jsonipc_error_printf(err, EINVAL, jsonipc_error_printf(err, EINVAL, "Missing client id");
"required: \"id\"");
return NULL; return NULL;
} }
struct cmd_disconnect_client* cmd = calloc(1, sizeof(*cmd)); struct cmd_disconnect_client* cmd = calloc(1, sizeof(*cmd));