tree-wide: print error if table_print() fails
We generally want to print an error message if table_print() fails. Add a helper function for this and use it consistently. This does one of the three things depending on the call site: - a no-change reformatting of the code - change from a custom message to the generic one - addition of the error message where previously none was printed In the third case, the actual use impact is very small, since the table formatting is very unlikely to fail. But if it did, we would often return an error without any message whatsoever, which we never want to do.
This commit is contained in:
@@ -115,9 +115,9 @@ static int output_jobs_list(sd_bus *bus, const struct job_info* jobs, unsigned n
|
||||
output_waiting_jobs(bus, table, j->id, "GetJobBefore", "\twaiting for job");
|
||||
}
|
||||
|
||||
r = table_print(table);
|
||||
r = table_print_or_warn(table);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to print the table: %m");
|
||||
return r;
|
||||
|
||||
if (arg_legend != 0) {
|
||||
on = ansi_highlight();
|
||||
|
||||
Reference in New Issue
Block a user