In V6 or earlier, we rely on framework code (mainly System.Text.Json or the HttpClient) to throw an exception when a supplied CancellationToken is cancelled. I think it's good form to cancel as early as possible, so we should add a cancellationToken.ThrowIfCancellationRequested() to our HaveIBeenPwnedClient.*Internal() methods after any argument and disposal checks.
⚠️ Warning: This might break user code that catches TaskCanceledException instead of OperationCanceledException. I have no idea if the HttpClient or System.Text.Json have used TaskCanceledException in the past.
In V6 or earlier, we rely on framework code (mainly
System.Text.Json
or theHttpClient
) to throw an exception when a suppliedCancellationToken
is cancelled. I think it's good form to cancel as early as possible, so we should add acancellationToken.ThrowIfCancellationRequested()
to ourHaveIBeenPwnedClient.*Internal()
methods after any argument and disposal checks.⚠️ Warning: This might break user code that catches
TaskCanceledException
instead ofOperationCanceledException
. I have no idea if theHttpClient
orSystem.Text.Json
have usedTaskCanceledException
in the past.