Open
Description
Is your feature request related to a problem? Please describe.
When testing certain Polly policies, it can be useful to throw a connection. However it is not really easy to know what the most common exceptions are that can be thrown by the HttpClientHandler.
Describe the solution you'd like
Add a new ExceptionResponse
which can easily throw an HttpRequestException
.
As far as I can tell, no other exceptions are thrown by the handler and every exception is wrapped into an HttpRequestException
.
Describe alternatives you've considered
As an alternative you can use Responses.Configure(_ => throw new HttpRequestExeption())
, however this is more verbose and it would be great to get this in the library itself.
Additional context
- Documentation of SendAsync shows the exceptions that are generally thrown.
TaskCancelledException
is already useable viaResponses.Timeout()
ArgumentNullException
andInvalidOperationException
are handled by HttpClient itself.