]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/dbus-timer: improve error messages
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 14 Dec 2017 12:52:47 +0000 (21:52 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 15 Dec 2017 00:10:28 +0000 (09:10 +0900)
src/core/dbus-timer.c

index 3e64536b17d354be267c6d9ea219b9d5b41bfe36..12cebc2ccccd58bd13263c1db5e77e1c49a60585 100644 (file)
@@ -200,7 +200,7 @@ static int bus_timer_set_transient_property(
 
                 b = timer_base_from_string(name);
                 if (b < 0)
-                        return -EINVAL;
+                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown timer base");
 
                 r = sd_bus_message_read(message, "t", &u);
                 if (r < 0)
@@ -235,6 +235,8 @@ static int bus_timer_set_transient_property(
 
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         r = calendar_spec_from_string(str, &c);
+                        if (r == -EINVAL)
+                                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid calendar spec");
                         if (r < 0)
                                 return r;