Decide by the answer, not by the error message, whether a request failed

This commit is contained in:
Thorsten Sommer 2026-09-22 21:26:25 +02:00
parent 83c7078721
commit 9012381ea5
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -872,7 +872,15 @@ public abstract class BaseProvider : IProvider, ISecretId
await Task.Delay(TimeSpan.FromSeconds(timeSeconds), effectiveCancellationToken);
}
if(retry >= MAX_RETRIES || !string.IsNullOrWhiteSpace(errorMessage))
//
// Whether this request got an answer at all. The response is set in the success branch and
// nowhere else, so its absence is what "we have nothing to hand on" means. Going by the
// error message instead was wrong in both directions: a provider which sends no reason
// phrase left that message empty, and this method then reported success without a response
// for the caller to read; and an attempt which succeeded as the last one the loop allows
// was reported as a failure although its answer was right there.
//
if(response is null)
{
if (lastProviderRequestFailure is not ProviderRequestFailureReason.NONE)
{