sd_bus_message* reply = NULL;
const void* buffer = NULL;
sd_bus_message* m = NULL;
+ sd_bus_error error = {};
char path[PATH_MAX];
size_t bytes_written = 0;
size_t length = 0;
goto ERROR;
}
+ // Send from when we want the graph to be rendered
+ if (ctx->interval.since) {
+ r = sd_bus_message_append(m, "{sv}", "since", "s", ctx->interval.since);
+ if (r < 0)
+ goto ERROR;
+ }
+
+ // Send until when we want the graph to be rendered
+ if (ctx->interval.until) {
+ r = sd_bus_message_append(m, "{sv}", "until", "s", ctx->interval.until);
+ if (r < 0)
+ goto ERROR;
+ }
+
// Close the array
r = sd_bus_message_close_container(m);
if (r < 0)
goto ERROR;
// Call the message
- r = sd_bus_call(ctx->bus, m, 0, NULL, &reply);
+ r = sd_bus_call(ctx->bus, m, 0, &error, &reply);
if (r < 0) {
- perror("Failed to call the Render() method");
+ // Fetch the error code
+ errno = sd_bus_error_get_errno(&error);
+
+ // Print the error message
+ if (error.message) {
+ fprintf(stderr, "%s: %s\n", program_invocation_name, error.message);
+ } else {
+ perror("Failed to call the Render() method");
+ }
+
goto ERROR;
}