mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
change(NetRequest): log server response on error
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
62e17cd19e
commit
7f3790bf73
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