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
Object
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 System.Net.Http.HttpResponseMessage.

Exceptions

System.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 System.Exception. Do not use in Production environment.

ToHttpResponseMessage(HttpExceptionDescriptor)

Converts this instance into an System.Net.Http.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 System.Net.Http.HttpResponseMessage from the by constructor provided factory.

Exceptions

System.ArgumentNullException

descriptor cannot be null.