mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-08 13:08:29 +02:00
Network: log server response on error (#4726)
Some checks failed
Build / Build (Linux) (push) Has been cancelled
Build / Build (Linux-aarch64) (push) Has been cancelled
Build / Build (Windows-MSVC) (push) Has been cancelled
Build / Build (Windows-MSVC-arm64) (push) Has been cancelled
Build / Build (Windows-MinGW-arm64) (push) Has been cancelled
Build / Build (Windows-MinGW-w64) (push) Has been cancelled
Build / Build (macOS) (push) Has been cancelled
CodeQL Code Scanning / CodeQL (push) Has been cancelled
Flatpak / Build (x86_64) (push) Has been cancelled
Nix / Build (aarch64-darwin) (push) Has been cancelled
Nix / Build (x86_64-linux) (push) Has been cancelled
Nix / Build (aarch64-linux) (push) Has been cancelled
Some checks failed
Build / Build (Linux) (push) Has been cancelled
Build / Build (Linux-aarch64) (push) Has been cancelled
Build / Build (Windows-MSVC) (push) Has been cancelled
Build / Build (Windows-MSVC-arm64) (push) Has been cancelled
Build / Build (Windows-MinGW-arm64) (push) Has been cancelled
Build / Build (Windows-MinGW-w64) (push) Has been cancelled
Build / Build (macOS) (push) Has been cancelled
CodeQL Code Scanning / CodeQL (push) Has been cancelled
Flatpak / Build (x86_64) (push) Has been cancelled
Nix / Build (aarch64-darwin) (push) Has been cancelled
Nix / Build (x86_64-linux) (push) Has been cancelled
Nix / Build (aarch64-linux) (push) Has been cancelled
This commit is contained in:
commit
c64d871a28
2 changed files with 8 additions and 2 deletions
|
|
@ -169,9 +169,11 @@ void NetRequest::downloadError(QNetworkReply::NetworkError error)
|
|||
}
|
||||
}
|
||||
// error happened during download.
|
||||
qCCritical(logCat) << getUid().toString() << "Failed" << m_url.toString() << "with reason" << error;
|
||||
qCCritical(logCat) << getUid().toString() << "Failed" << m_url.toString() << "with error" << error;
|
||||
if (m_reply)
|
||||
qCCritical(logCat) << getUid().toString() << "HTTP Status" << replyStatusCode() << ";error" << errorString();
|
||||
qCCritical(logCat) << getUid().toString() << "HTTP status:" << replyStatusCode() << errorString();
|
||||
if (m_errorResponse.size() > 0)
|
||||
qCCritical(logCat) << getUid().toString() << "Response from server:" << m_errorResponse;
|
||||
m_state = State::Failed;
|
||||
}
|
||||
}
|
||||
|
|
@ -308,6 +310,9 @@ void NetRequest::downloadReadyRead()
|
|||
if (m_state == State::Running) {
|
||||
auto data = m_reply->readAll();
|
||||
m_state = m_sink->write(data);
|
||||
if (replyStatusCode() >= 400) {
|
||||
m_errorResponse.append(data);
|
||||
}
|
||||
if (m_state == State::Failed) {
|
||||
qCCritical(logCat) << getUid().toString() << "Failed to process response chunk:" << m_sink->failReason();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ class NetRequest : public Task {
|
|||
|
||||
/// the network reply
|
||||
unique_qobject_ptr<QNetworkReply> m_reply;
|
||||
QByteArray m_errorResponse;
|
||||
|
||||
/// source URL
|
||||
QUrl m_url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue