Correct some warnings

This commit is contained in:
JustArchi 2021-03-11 22:32:59 +01:00 committed by dependabot-preview[bot]
parent cfa8b61f31
commit 0bd8ff2d7d

View file

@ -119,13 +119,14 @@ namespace ArchiSteamFarm {
}
for (byte i = 0; i < maxTries; i++) {
await using StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
// Request timed out, try again
continue;
}
await using (response.ConfigureAwait(false)) {
if (response.StatusCode.IsClientErrorCode()) {
if (!requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
// We're not handling this error, do not try again
@ -193,6 +194,7 @@ namespace ArchiSteamFarm {
return new BinaryResponse(response, ms.ToArray());
}
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.ErrorRequestFailedTooManyTimes, maxTries));
@ -213,13 +215,14 @@ namespace ArchiSteamFarm {
}
for (byte i = 0; i < maxTries; i++) {
await using StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
// Request timed out, try again
continue;
}
await using (response.ConfigureAwait(false)) {
if (response.StatusCode.IsClientErrorCode()) {
if (!requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
// We're not handling this error, do not try again
@ -238,6 +241,7 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericWarningException(e);
}
}
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.ErrorRequestFailedTooManyTimes, maxTries));
@ -258,13 +262,14 @@ namespace ArchiSteamFarm {
}
for (byte i = 0; i < maxTries; i++) {
await using StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
// Request timed out, try again
continue;
}
await using (response.ConfigureAwait(false)) {
if (response.StatusCode.IsClientErrorCode()) {
if (!requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
// We're not handling this error, do not try again
@ -300,6 +305,7 @@ namespace ArchiSteamFarm {
return new ObjectResponse<T>(response, obj);
}
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.ErrorRequestFailedTooManyTimes, maxTries));
@ -402,13 +408,14 @@ namespace ArchiSteamFarm {
}
for (byte i = 0; i < maxTries; i++) {
await using StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
StreamResponse? response = await UrlGetToStream(request, headers, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
// Request timed out, try again
continue;
}
await using (response.ConfigureAwait(false)) {
if (response.StatusCode.IsClientErrorCode()) {
if (!requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
// We're not handling this error, do not try again
@ -433,6 +440,7 @@ namespace ArchiSteamFarm {
return new XmlDocumentResponse(response, xmlDocument);
}
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.ErrorRequestFailedTooManyTimes, maxTries));
@ -545,13 +553,14 @@ namespace ArchiSteamFarm {
}
for (byte i = 0; i < maxTries; i++) {
await using StreamResponse? response = await UrlPostToStream(request, headers, data, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
StreamResponse? response = await UrlPostToStream(request, headers, data, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
// Request timed out, try again
continue;
}
await using (response.ConfigureAwait(false)) {
if (response.StatusCode.IsClientErrorCode()) {
if (!requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
// We're not handling this error, do not try again
@ -570,6 +579,7 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericWarningException(e);
}
}
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.ErrorRequestFailedTooManyTimes, maxTries));
@ -590,13 +600,14 @@ namespace ArchiSteamFarm {
}
for (byte i = 0; i < maxTries; i++) {
await using StreamResponse? response = await UrlPostToStream(request, headers, data, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
StreamResponse? response = await UrlPostToStream(request, headers, data, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
// Request timed out, try again
continue;
}
await using (response.ConfigureAwait(false)) {
if (response.StatusCode.IsClientErrorCode()) {
if (!requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
// We're not handling this error, do not try again
@ -632,6 +643,7 @@ namespace ArchiSteamFarm {
return new ObjectResponse<TResult>(response, obj);
}
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.ErrorRequestFailedTooManyTimes, maxTries));