i3-msg: only print input + errorposition if they exist

Before:
$ i3-msg floating disable, move window to position 100 px 100 px
ERROR: Your command: (null)
ERROR:               (null)
ERROR: Cannot change position of a window/container because it is not floating.
[{"success":true},{"success":false,"error":"Cannot change position of a window/container because it is not floating."}]

After:
$ i3-msg floating disable, move window to position 100 px 100 px
ERROR: Cannot change position of a window/container because it is not floating.
[{"success":true},{"success":false,"error":"Cannot change position of a window/container because it is not floating."}]
This commit is contained in:
Orestis Floros 2018-03-18 03:38:06 +02:00
parent 8f5c1cb6b8
commit 124e64767e
1 changed files with 4 additions and 2 deletions

View File

@ -95,8 +95,10 @@ static int reply_start_map_cb(void *params) {
static int reply_end_map_cb(void *params) { static int reply_end_map_cb(void *params) {
if (!last_reply.success) { if (!last_reply.success) {
fprintf(stderr, "ERROR: Your command: %s\n", last_reply.input); if (last_reply.input) {
fprintf(stderr, "ERROR: %s\n", last_reply.errorposition); fprintf(stderr, "ERROR: Your command: %s\n", last_reply.input);
fprintf(stderr, "ERROR: %s\n", last_reply.errorposition);
}
fprintf(stderr, "ERROR: %s\n", last_reply.error); fprintf(stderr, "ERROR: %s\n", last_reply.error);
} }
return 1; return 1;