Format dbus errors logging

This commit is contained in:
Ilya Fedin 2021-01-22 16:07:31 +04:00 committed by John Preston
parent 1e2759840d
commit 690c5df87c
3 changed files with 26 additions and 13 deletions

View file

@ -430,7 +430,10 @@ bool IsSNIAvailable() {
break;
}
LOG(("SNI Error: %1").arg(reply.error().message()));
LOG(("SNI Error: %1: %2")
.arg(reply.error().name())
.arg(reply.error().message()));
return false;
}

View file

@ -92,8 +92,9 @@ void GetServerInformation(Fn<void(std::optional<ServerInformation>)> callback) {
});
});
} else {
LOG(("Native notification error: %1").arg(
reply.error().message()));
LOG(("Native Notification Error: %1: %2")
.arg(reply.error().name())
.arg(reply.error().message()));
crl::on_main([=] { callback(std::nullopt); });
}
@ -120,8 +121,9 @@ void GetCapabilities(Fn<void(QStringList)> callback) {
if (reply.isValid()) {
crl::on_main([=] { callback(reply.value()); });
} else {
LOG(("Native notification error: %1").arg(
reply.error().message()));
LOG(("Native Notification Error: %1: %2")
.arg(reply.error().name())
.arg(reply.error().message()));
crl::on_main([=] { callback({}); });
}
@ -151,7 +153,9 @@ void GetInhibitionSupported(Fn<void(bool)> callback) {
const auto error = QDBusPendingReply<QVariant>(*call).error();
if (error.isValid() && error.type() != QDBusError::InvalidArgs) {
LOG(("Native notification error: %1").arg(error.message()));
LOG(("Native Notification Error: %1: %2")
.arg(error.name())
.arg(error.message()));
}
crl::on_main([=] { callback(!error.isValid()); });
@ -186,7 +190,10 @@ bool Inhibited() {
return reply.value().toBool();
}
LOG(("Native notification error: %1").arg(reply.error().message()));
LOG(("Native Notification Error: %1: %2")
.arg(reply.error().name())
.arg(reply.error().message()));
return false;
}
@ -220,7 +227,7 @@ QString GetImageKey(const QVersionNumber &specificationVersion) {
const auto normalizedVersion = specificationVersion.normalized();
if (normalizedVersion.isNull()) {
LOG(("Native notification error: specification version is null"));
LOG(("Native Notification Error: specification version is null"));
return QString();
}
@ -314,7 +321,7 @@ NotificationData::NotificationData(
&error);
if (error) {
LOG(("Native notification error: %1").arg(error->message));
LOG(("Native Notification Error: %1").arg(error->message));
g_error_free(error);
return;
}
@ -528,7 +535,7 @@ void NotificationData::notificationShown(
crl::on_main(manager, [=] {
manager->clearNotification(my);
});
LOG(("Native notification error: %1").arg(error->message));
LOG(("Native Notification Error: %1").arg(error->message));
g_error_free(error);
}
}

View file

@ -104,7 +104,7 @@ QStringList ListDBusActivatableNames() {
if (reply.isValid()) {
return reply.value();
} else if (reply.error().type() != QDBusError::Disconnected) {
LOG(("App Error: %1: %2")
LOG(("ListActivatableNames Error: %1: %2")
.arg(reply.error().name())
.arg(reply.error().message()));
}
@ -160,7 +160,9 @@ void PortalAutostart(bool autostart, bool silent = false) {
const QDBusError error = QDBusConnection::sessionBus().call(message);
if (error.isValid()) {
LOG(("Flatpak autostart error: %1").arg(error.message()));
LOG(("Flatpak Autostart Error: %1: %2")
.arg(error.name())
.arg(error.message()));
}
}
@ -218,7 +220,8 @@ uint FileChooserPortalVersion() {
return reply.value().toUInt();
}
LOG(("Error getting FileChooser portal version: %1")
LOG(("Error getting FileChooser portal version: %1: %2")
.arg(reply.error().name())
.arg(reply.error().message()));
return 0;