From ffd4e7ab0148f67c685f18c585ac220fa562079b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 29 Apr 2026 17:52:50 +0200 Subject: [PATCH] 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. --- src/report/report-upload.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/report/report-upload.c b/src/report/report-upload.c index fce0c0e551..471bcb7606 100644 --- a/src/report/report-upload.c +++ b/src/report/report-upload.c @@ -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: ");