Skip to content

Commit

Permalink
adding new errors to isRetryableNetworkError
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Nov 22, 2024
1 parent 4d5cd9c commit 273c569
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core/merginapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3960,17 +3960,18 @@ bool MerginApi::isRetryableNetworkError( QNetworkReply *reply )
Q_ASSERT( reply );

QNetworkReply::NetworkError err = reply->error();
int httpCode = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt();

bool isRetryableError = ( err == QNetworkReply::TimeoutError ||
err == QNetworkReply::TemporaryNetworkFailureError ||
err == QNetworkReply::NetworkSessionFailedError ||
err == QNetworkReply::UnknownNetworkError );

bool isRetryableHttpCode = ( httpCode == 500 || httpCode == 502 ||
httpCode == 503 || httpCode == 504 );

return isRetryableError || isRetryableHttpCode;
err == QNetworkReply::UnknownNetworkError ||
err == QNetworkReply::RemoteHostClosedError ||
err == QNetworkReply::ProxyConnectionClosedError ||
err == QNetworkReply::ProxyTimeoutError ||
err == QNetworkReply::UnknownProxyError ||
err == QNetworkReply::ServiceUnavailableError );

return isRetryableError;
}

void MerginApi::setNetworkManager( QNetworkAccessManager *manager )
Expand Down

0 comments on commit 273c569

Please sign in to comment.