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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user