summaryrefslogtreecommitdiff
path: root/src/analyze
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-07 21:26:31 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-07 21:26:31 +0100
commit5b30bef856e89a571df57b7b953e9a1409d9aced (patch)
tree815d8648bf7b59a35c1cda35174b8b1e08cac323 /src/analyze
parent46e65dcc3a522b5e992e165b5e61d14254026859 (diff)
bus: log message parsing errors everywhere with a generalized bus_log_parse_error()
Diffstat (limited to 'src/analyze')
-rw-r--r--src/analyze/analyze.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 22bf07670e..715ad73ff9 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -190,10 +190,8 @@ static int bus_parse_unit_info(sd_bus_message *message, struct unit_info *u) {
&u->job_id,
&u->job_type,
&u->job_path);
- if (r < 0) {
- log_error("Failed to parse message as unit_info.");
- return -EIO;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
return r;
}
@@ -230,6 +228,9 @@ static int bus_get_unit_property_strv(sd_bus *bus, const char *unit_path, const
}
}
+ if (r < 0)
+ return bus_log_parse_error(r);
+
return r;
}
@@ -839,15 +840,13 @@ static int list_dependencies(sd_bus *bus, const char *name) {
&reply,
"s");
if (r < 0) {
- log_error("Failed to parse reply: %s", bus_error_message(&error, -r));
+ log_error("Failed to get ID: %s", bus_error_message(&error, -r));
return r;
}
r = sd_bus_message_read(reply, "s", &id);
- if (r < 0) {
- log_error("Failed to parse reply.");
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
times = hashmap_get(unit_times_hashmap, id);
@@ -1114,10 +1113,8 @@ static int dump(sd_bus *bus, char **args) {
}
r = sd_bus_message_read(reply, "s", &text);
- if (r < 0) {
- log_error("Failed to parse reply");
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
fputs(text, stdout);
return 0;