From caec0e3e11b18c451335c5861d6d6d72a69f743c Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Thu, 14 May 2020 21:52:23 -0600 Subject: [PATCH] Don't retry http response errors --- Wabbajack.Common/Http/Client.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Wabbajack.Common/Http/Client.cs b/Wabbajack.Common/Http/Client.cs index 5cddbb55..a58aed49 100644 --- a/Wabbajack.Common/Http/Client.cs +++ b/Wabbajack.Common/Http/Client.cs @@ -76,12 +76,15 @@ namespace Wabbajack.Common.Http var response = await ClientFactory.Client.SendAsync(msg, responseHeadersRead); if (response.IsSuccessStatusCode) return response; - if (errorsAsExceptions) - throw new HttpRequestException($"Http Exception {response.StatusCode} - {response.ReasonPhrase} - {msg.RequestUri}");; + if (errorsAsExceptions) + throw new HttpRequestException( + $"Http Exception {response.StatusCode} - {response.ReasonPhrase} - {msg.RequestUri}"); + ; return response; } - catch (Exception) + catch (Exception ex) { + if (ex is HttpRequestException) throw; if (retries > Consts.MaxHTTPRetries) throw; retries++;