on server errors, treat account as offline

Signed-off-by: Tayou <git@tayou.org>
This commit is contained in:
Tayou 2026-06-04 21:17:03 +02:00
parent 803115cfde
commit 0a3adb7912
No known key found for this signature in database
GPG key ID: AAAF6C17E5E51872
5 changed files with 18 additions and 4 deletions

View file

@ -40,4 +40,18 @@ inline bool isApplicationError(QNetworkReply::NetworkError x)
QNetworkReply::UnknownContentError };
return errors.contains(x);
}
// 500 class errors, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/500
// microsoft may send these error codes when services (auth) are down.
// We treat this as a reason to launch in offline mode.
inline bool isServerError(QNetworkReply::NetworkError x)
{
static QSet<QNetworkReply::NetworkError> errors = { QNetworkReply::InternalServerError,
QNetworkReply::OperationNotImplementedError,
QNetworkReply::ServiceUnavailableError, // 503 | seen in logs in 2026
//QNetworkReply::GatewayTimeoutError, // 504 | seen in logs in 2024
// Qt doesn't have it mapped. Unknown covers it
QNetworkReply::UnknownServerError };
return errors.contains(x);
}
} // namespace Net