feat(ipc): Log more detail on IPC error handling

This commit is contained in:
Nick Bolton 2026-03-31 10:24:59 +01:00
parent 25f3eb3f22
commit 77bee2ddf3
2 changed files with 9 additions and 1 deletions

View file

@ -118,7 +118,7 @@ void IpcServer::processMessage(QLocalSocket *clientSocket, const QString &messag
if (clientVersion != versionId) {
LOG_ERR("%s ipc client version mismatch (server: %s)", m_typeName.constData(), versionId.toUtf8().constData());
writeToClientSocket(clientSocket, "error");
writeToClientSocket(clientSocket, QStringLiteral("error=version mismatch, expected: %1").arg(versionId));
clientSocket->flush();
clientSocket->disconnectFromServer();
return;

View file

@ -163,6 +163,14 @@ void IpcClient::handleReadyRead()
void IpcClient::handleHandshakeMessage(const QStringList &parts)
{
if (parts.at(0) == "error") {
const auto detail = parts.size() >= 2 ? parts.at(1) : QString("unknown");
qCritical().noquote() << m_typeName << "ipc server rejected connection:" << detail;
disconnectFromServer();
Q_EMIT connectionFailed();
return;
}
if (parts.at(0) != "hello") {
return;
}