core: Catch sdbus-cpp exception to print better error (#19)

$ hypridle
[...]
[LOG] wayland done, registering dbus
Abort
This commit is contained in:
Jan Beich 2024-02-27 13:07:22 +00:00 committed by GitHub
parent b9c94ed827
commit 790988d116
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -430,10 +430,15 @@ void CHypridle::setupDBUS() {
auto proxy = sdbus::createProxy("org.freedesktop.login1", "/org/freedesktop/login1"); auto proxy = sdbus::createProxy("org.freedesktop.login1", "/org/freedesktop/login1");
auto method = proxy->createMethodCall("org.freedesktop.login1.Manager", "GetSession"); auto method = proxy->createMethodCall("org.freedesktop.login1.Manager", "GetSession");
method << "auto"; method << "auto";
auto reply = proxy->callMethod(method);
sdbus::ObjectPath path; sdbus::ObjectPath path;
try {
auto reply = proxy->callMethod(method);
reply >> path; reply >> path;
} catch (std::exception& e) {
Debug::log(CRIT, "Couldn't connect to logind service ({})", e.what());
exit(1);
}
Debug::log(LOG, "Using dbus path {}", path.c_str()); Debug::log(LOG, "Using dbus path {}", path.c_str());