Silence ServiceUnknown and Disconnected errors for native notifications

This commit is contained in:
Ilya Fedin 2021-04-27 16:17:10 +04:00 committed by John Preston
parent 3808874da0
commit cb930a89ce
1 changed files with 12 additions and 5 deletions

View File

@ -60,8 +60,17 @@ void StartServiceAsync(
try {
result(); // get the error if any
} catch (const Glib::Error &e) {
LOG(("Native Notification Error: %1").arg(
QString::fromStdString(e.what())));
static const auto NotSupportedErrors = {
"org.freedesktop.DBus.Error.ServiceUnknown",
};
const auto errorName =
Gio::DBus::ErrorUtils::get_remote_error(e);
if (!ranges::contains(NotSupportedErrors, errorName)) {
LOG(("Native Notification Error: %1").arg(
QString::fromStdString(e.what())));
}
} catch (const std::exception &e) {
LOG(("Native Notification Error: %1").arg(
QString::fromStdString(e.what())));
@ -72,9 +81,7 @@ void StartServiceAsync(
cancellable);
return;
} catch (const Glib::Error &e) {
LOG(("Native Notification Error: %1").arg(
QString::fromStdString(e.what())));
} catch (...) {
}
crl::on_main([=] { callback(); });