Table of Contents

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

contentType MediaTypeHeaderValue

The media type that this handler supports.

responseMessageFactory Func<HttpExceptionDescriptor, HttpResponseMessage>

The function delegate that produces the HttpResponseMessage.

Exceptions

ArgumentNullException

contentType cannot be null -or- responseMessageFactory cannot 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

sensitivityDetails FaultSensitivityDetails

The 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

descriptor HttpExceptionDescriptor

The exception descriptor tailored for HTTP requests.

Returns

HttpResponseMessage

An HttpResponseMessage from the by constructor provided factory.

Exceptions

ArgumentNullException

descriptor cannot be null.