From cb930a89ce78476fd34421a96bb2cdc3d0893b34 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 27 Apr 2021 16:17:10 +0400 Subject: [PATCH] Silence ServiceUnknown and Disconnected errors for native notifications --- .../linux/notifications_manager_linux.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index cf5a07099..286cd6313 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -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(); });