Silence ServiceUnknown and Disconnected errors for native notifications
This commit is contained in:
parent
3808874da0
commit
cb930a89ce
1 changed files with 12 additions and 5 deletions
|
@ -60,8 +60,17 @@ void StartServiceAsync(
|
||||||
try {
|
try {
|
||||||
result(); // get the error if any
|
result(); // get the error if any
|
||||||
} catch (const Glib::Error &e) {
|
} catch (const Glib::Error &e) {
|
||||||
LOG(("Native Notification Error: %1").arg(
|
static const auto NotSupportedErrors = {
|
||||||
QString::fromStdString(e.what())));
|
"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) {
|
} catch (const std::exception &e) {
|
||||||
LOG(("Native Notification Error: %1").arg(
|
LOG(("Native Notification Error: %1").arg(
|
||||||
QString::fromStdString(e.what())));
|
QString::fromStdString(e.what())));
|
||||||
|
@ -72,9 +81,7 @@ void StartServiceAsync(
|
||||||
cancellable);
|
cancellable);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} catch (const Glib::Error &e) {
|
} catch (...) {
|
||||||
LOG(("Native Notification Error: %1").arg(
|
|
||||||
QString::fromStdString(e.what())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
crl::on_main([=] { callback(); });
|
crl::on_main([=] { callback(); });
|
||||||
|
|
Loading…
Reference in a new issue