fix: Fail early when neither user nor system is requested

The module can be configured to neither request the user nor the system
session.

In fact does this display non-valuable information to the user and can
be considered as abuse case of the configuration.

Therefore throw an exception when neither user nor system session are
requested.

Signed-off-by: Steffen Kothe <steffen.kothe@skothe.net>
This commit is contained in:
Steffen Kothe
2025-08-15 10:55:25 +00:00
parent 41de8964f1
commit 4a7da0cab2
+3
View File
@@ -47,6 +47,9 @@ SystemdFailedUnits::SystemdFailedUnits(const std::string& id, const Json::Value&
user_proxy->signal_signal().connect(sigc::mem_fun(*this, &SystemdFailedUnits::notify_cb));
}
if (!user_proxy && !system_proxy)
throw std::runtime_error("Neither system nor user status is requested.");
updateData();
/* Always update for the first time. */
dp.emit();