Class HttpExceptionDescriptorResponseHandler
- Namespace
- Cuemon.AspNetCore.Diagnostics
- Assembly
- Cuemon.AspNetCore.dll
Provides a way to support content negotiation for HttpExceptionDescriptor.
public class HttpExceptionDescriptorResponseHandler
- Inheritance
-
HttpExceptionDescriptorResponseHandler
Constructors
HttpExceptionDescriptorResponseHandler(MediaTypeHeaderValue, Func<HttpExceptionDescriptor, HttpResponseMessage>)
Initializes a new instance of the HttpExceptionDescriptorResponseHandler class.
public HttpExceptionDescriptorResponseHandler(MediaTypeHeaderValue contentType, Func<HttpExceptionDescriptor, HttpResponseMessage> responseMessageFactory)
Parameters
contentTypeMediaTypeHeaderValueThe media type that this handler supports.
responseMessageFactoryFunc<HttpExceptionDescriptor, HttpResponseMessage>The function delegate that produces the HttpResponseMessage.
Exceptions
- ArgumentNullException
contentTypecannot be null -or-responseMessageFactorycannot be null.
Properties
ContentType
Gets the media type that this handler supports.
public MediaTypeHeaderValue ContentType { get; }
Property Value
- MediaTypeHeaderValue
The media type that this handler supports.
Methods
CreateDefaultFallbackHandler(FaultSensitivityDetails)
Creates a scaled down HttpExceptionDescriptorResponseHandler suitable as fallback handler for when content negotiation fails.
public static HttpExceptionDescriptorResponseHandler CreateDefaultFallbackHandler(FaultSensitivityDetails sensitivityDetails)
Parameters
sensitivityDetailsFaultSensitivityDetailsThe bitwise combination of the enumeration values that specify which sensitive details to include in the serialized result.
Returns
- HttpExceptionDescriptorResponseHandler
A new instance of a scaled down HttpExceptionDescriptorResponseHandler.
Remarks
This scaled down implementation of a fallback handler requires All to provide developer friendly insights about an Exception. Do not use in Production environment.
ToHttpResponseMessage(HttpExceptionDescriptor)
Converts this instance into an HttpResponseMessage from the by constructor provided factory.
public HttpResponseMessage ToHttpResponseMessage(HttpExceptionDescriptor descriptor)
Parameters
descriptorHttpExceptionDescriptorThe exception descriptor tailored for HTTP requests.
Returns
- HttpResponseMessage
An HttpResponseMessage from the by constructor provided factory.
Exceptions
- ArgumentNullException
descriptorcannot be null.