Class ErrorHandler
- Namespace
- Autodesk.Common.HttpClientLibrary.Middleware
- Assembly
- Autodesk.Common.HttpClientLibrary.dll
Error handler for the HttpClient that will throw an exception if the response is not successful.
public class ErrorHandler : DelegatingHandler, IDisposable
- Inheritance
-
ErrorHandler
- Implements
- Inherited Members
Constructors
ErrorHandler(ErrorHandlerOption?)
public ErrorHandler(ErrorHandlerOption? errorHandlerOptions = null)
Parameters
errorHandlerOptions
ErrorHandlerOption
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.