summaryrefslogtreecommitdiffstats
path: root/src/core/dbus-manager.c
diff options
context:
space:
mode:
authorJacek Migacz <jmigacz@redhat.com>2022-09-18 15:41:38 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-10-25 18:18:57 +0200
commitc89d0c3b0567eb8fdf0b06a27f46c64245d2f0a4 (patch)
tree51e625109b8275b9396a66eac02a603e2850be67 /src/core/dbus-manager.c
parentupdate TODO (diff)
downloadsystemd-c89d0c3b0567eb8fdf0b06a27f46c64245d2f0a4.tar.xz
systemd-c89d0c3b0567eb8fdf0b06a27f46c64245d2f0a4.zip
core: give a nicer error message on invalid aliases
Diffstat (limited to '')
-rw-r--r--src/core/dbus-manager.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 633873da27..919aa58cde 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -2176,6 +2176,16 @@ static int install_error(
"File %s is under the systemd unit hierarchy already.", changes[i].path);
goto found;
+ case -EBADSLT:
+ r = sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING,
+ "Invalid specifier in %s.", changes[i].path);
+ goto found;
+
+ case -EIDRM:
+ r = sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING,
+ "Destination unit %s is a non-template unit.", changes[i].path);
+ goto found;
+
case -EUCLEAN:
r = sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING,
"\"%s\" is not a valid unit name.",
@@ -2188,11 +2198,26 @@ static int install_error(
changes[i].path);
goto found;
+ case -EXDEV:
+ if (changes[i].source)
+ r = sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING,
+ "Cannot alias %s as %s.",
+ changes[i].source, changes[i].path);
+ else
+ r = sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING,
+ "Invalid unit reference %s.", changes[i].path);
+ goto found;
+
case -ENOENT:
r = sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT,
"Unit file %s does not exist.", changes[i].path);
goto found;
+ case -EUNATCH:
+ r = sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING,
+ "Cannot resolve specifiers in %s.", changes[i].path);
+ goto found;
+
default:
assert(changes[i].type < 0); /* other errors */
r = sd_bus_error_set_errnof(error, changes[i].type, "File %s: %m", changes[i].path);