Skip to content

Commit 898890a

Browse files
committed
feat: log detailed dbus error messages on failure
The current implementation only printed generic warning messages when D-Bus calls failed during session initialization. This made it difficult to diagnose underlying issues like systemd transaction conflicts or permission errors. Log: Added detailed D-Bus error reporting to improve diagnostic capability Influence: 1. Verify that logs now show detailed error strings when D-Bus calls fail
1 parent 55ab525 commit 898890a

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/dde-session/environmentsmanager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void EnvironmentsManager::init()
5151
QDBusPendingReply<void> replySystemd1 = systemd1.SetEnvironment(envs);
5252
replySystemd1.waitForFinished();
5353
if (replySystemd1.isError()) {
54-
qWarning() << "failed to set systemd1 envs: " << envs;
54+
qWarning() << "failed to set systemd1 envs: " << envs << ", error:" << replySystemd1.error();
5555
}
5656

5757
// dbus
@@ -64,7 +64,7 @@ void EnvironmentsManager::init()
6464
QDBusPendingReply<void> replyDbus = dbus.UpdateActivationEnvironment(envInfos);
6565
replyDbus.waitForFinished();
6666
if (replyDbus.isError()) {
67-
qWarning() << "failed to update dbus envs:" << envInfos;
67+
qWarning() << "failed to update dbus envs:" << envInfos << ", error:" << replyDbus.error();
6868
}
6969
}
7070

@@ -146,7 +146,7 @@ bool EnvironmentsManager::unsetEnv(QString env)
146146
QDBusPendingReply<void> replyDbus = dbus.UpdateActivationEnvironment(envs);
147147
replyDbus.waitForFinished();
148148
if (replyDbus.isError()) {
149-
qWarning() << "unset dbus env failed:" << env;
149+
qWarning() << "unset dbus env failed:" << env << ", error:" << replyDbus.error();
150150
return false;
151151
}
152152

src/dde-session/impl/sessionmanager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,14 +990,14 @@ void SessionManager::handleLoginSessionUnlocked()
990990
org::freedesktop::DBus dbusInter("org.freedesktop.DBus", "/org/freedesktop/DBus", QDBusConnection::sessionBus());
991991
QDBusPendingReply<QString> ownerReply = dbusInter.GetNameOwner("org.deepin.dde.LockFront1");
992992
if (ownerReply.isError()) {
993-
qWarning() << "failed to get lockFront service owner";
993+
qWarning() << "failed to get lockFront service owner" << ", error:" << ownerReply.error();
994994
return;
995995
}
996996
const QString &owner = ownerReply.value();
997997

998998
QDBusPendingReply<uint> pidReply = dbusInter.GetConnectionUnixProcessID(owner);
999999
if (pidReply.isError()) {
1000-
qWarning() << "failed to get lockFront service pid";
1000+
qWarning() << "failed to get lockFront service pid" << ", error:" << pidReply.error();
10011001
return;
10021002
}
10031003
uint pid = pidReply.value();

src/dde-session/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int startSystemdUnit(org::freedesktop::systemd1::Manager &systemd1, const QStrin
3636
QDBusPendingReply<QDBusObjectPath> reply = systemd1.StartUnit(unitName, unitType);
3737
reply.waitForFinished();
3838
if (reply.isError()) {
39-
qWarning() << "start systemd unit failed:" << unitName;
39+
qWarning() << "start systemd unit failed:" << unitName << ", error:" << reply.error();
4040
return -1;
4141
}
4242
qInfo() << "success to start systemd unit:" << unitName << ", job path:" << reply.value().path();

0 commit comments

Comments
 (0)