Make it easy to throw relevant exceptions #203
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
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 anHttpRequestException
.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
TaskCancelledException
is already useable viaResponses.Timeout()
ArgumentNullException
andInvalidOperationException
are handled by HttpClient itself.The text was updated successfully, but these errors were encountered: