]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
report: when a report fails, print the json error details
authorMichael Vogt <michael@amutable.com>
Wed, 29 Apr 2026 15:52:50 +0000 (17:52 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Tue, 5 May 2026 16:13:28 +0000 (18:13 +0200)
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

index fce0c0e551396cb43fa03d1323b8961c9962691f..471bcb760600e5a0e68d2f99f2698a2cc53e628e 100644 (file)
@@ -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: ");