From d815e336dd970a7159aae8a1a19e871eef780bb7 Mon Sep 17 00:00:00 2001 From: David Courtel Date: Sun, 24 Mar 2024 17:02:58 +0100 Subject: [PATCH] Remove default error message text. --- src/Middleware/RetryHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Middleware/RetryHandler.cs b/src/Middleware/RetryHandler.cs index c20df77..4087f6e 100644 --- a/src/Middleware/RetryHandler.cs +++ b/src/Middleware/RetryHandler.cs @@ -234,7 +234,7 @@ private static bool ShouldRetry(HttpStatusCode statusCode) private static async Task GetInnerException(HttpResponseMessage response, CancellationToken cancellationToken) { var httpStatusCode = response.StatusCode; - var errorMessage = "The response has not content."; + string? errorMessage = null; // Drain response content to free connections. Need to perform this // before retry attempt and before the TooManyRetries ServiceException. @@ -248,7 +248,7 @@ private static async Task GetInnerException(HttpResponseMessage respo errorMessage = GetStringFromContent(responseContent); } - return new Exception($"HTTP request failed with status code: {httpStatusCode}. Error Message: {errorMessage}"); + return new Exception($"HTTP request failed with status code: {httpStatusCode}.{errorMessage}"); } private static string GetStringFromContent(byte[] content)