handle dbus errors in connect

This commit is contained in:
vaxerski 2023-08-28 22:21:36 +02:00
parent 2aed59f8bc
commit 0fb5448745

View file

@ -237,7 +237,12 @@ void CPortalManager::onGlobalRemoved(void* data, struct wl_registry* registry, u
}
void CPortalManager::init() {
m_pConnection = sdbus::createDefaultBusConnection("org.freedesktop.impl.portal.desktop.hyprland");
try {
m_pConnection = sdbus::createDefaultBusConnection("org.freedesktop.impl.portal.desktop.hyprland");
} catch (std::exception& e) {
Debug::log(CRIT, "Couldn't create the dbus connection ({})", e.what());
exit(1);
}
if (!m_pConnection) {
Debug::log(CRIT, "Couldn't connect to dbus");