Class ErrorHandler
- Namespace
- Autodesk.Common.HttpClientLibrary
- Assembly
- Autodesk.Common.HttpClientLibrary.dll
Error handler for the HttpClient that will throw an exception if the response is not successful, and will include the response body in the exception message.
public class ErrorHandler : DelegatingHandler, IDisposable
- Inheritance
-
ErrorHandler
- Implements
- Inherited Members
Constructors
ErrorHandler(HttpMessageHandler?)
public ErrorHandler(HttpMessageHandler? innerHandler = null)
Parameters
innerHandler
HttpMessageHandler
Methods
SendAsync(HttpRequestMessage, CancellationToken)
Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
request
HttpRequestMessageThe HTTP request message to send to the server.
cancellationToken
CancellationTokenA cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
The
request
was null.