report: when a report fails, print the json error details
When a report upload fails the backend often provides useful details via the varlink error. Show them as part of the upload error message. For now we just dump the json because we have no structure that the backends should follow. We may want to consider adding one (like check for an "error_message" key in the json). But for now this is a nice step forward.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
9c336ef6eb
commit
ffd4e7ab01
@@ -218,7 +218,11 @@ static int execute_dir_reply(
|
||||
if (error_id) {
|
||||
r = sd_varlink_error_to_errno(error_id, reply);
|
||||
RET_GATHER(context->upload_result, r);
|
||||
return log_error_errno(r, "Upload via Varlink failed: %s", error_id);
|
||||
log_error_errno(r, "Upload via Varlink failed: %s", error_id);
|
||||
if (reply)
|
||||
(void) sd_json_variant_dump(reply, arg_json_format_flags,
|
||||
/* f= */ NULL, /* prefix= */ NULL);
|
||||
return r;
|
||||
}
|
||||
|
||||
printf("Upload via Varlink was successful; reply: ");
|
||||
|
||||
Reference in New Issue
Block a user