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.
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: ");