Table of Contents

Class HttpFaultResolverDecoratorExtensions

Namespace
Cuemon.AspNetCore.Diagnostics
Assembly
Cuemon.AspNetCore.dll

Extension methods for the HttpFaultResolver class hidden behind the IDecorator<T> interface.

public static class HttpFaultResolverDecoratorExtensions
Inheritance
Object
HttpFaultResolverDecoratorExtensions

Methods

AddHttpFaultResolver<T>(IDecorator<IList<HttpFaultResolver>>, Func<T, HttpExceptionDescriptor>, Func<Exception, Boolean>)

Adds the specified function delegate exceptionDescriptorResolver and function delegate exceptionValidator to the enclosed IList{FaultResolver} of the decorator.

public static IDecorator<IList<HttpFaultResolver>> AddHttpFaultResolver<T>(this IDecorator<IList<HttpFaultResolver>> decorator, Func<T, HttpExceptionDescriptor> exceptionDescriptorResolver, Func<Exception, bool> exceptionValidator)
    where T : Exception

Parameters

decorator IDecorator<IList<HttpFaultResolver>>

The IDecorator<T> to extend.

exceptionDescriptorResolver Func<T, HttpExceptionDescriptor>

The function delegate that associates an System.Exception of type T with an HttpExceptionDescriptor.

exceptionValidator Func<Exception, Boolean>

The function delegate that evaluates an System.Exception.

Returns

IDecorator<IList<HttpFaultResolver>>

The IDecorator{IList{FaultResolver}} instance.

Type Parameters

T

The type of the System.Exception to associate with a HttpFaultResolver.

Exceptions

System.ArgumentNullException

decorator cannot be null.

AddHttpFaultResolver<T>(IDecorator<IList<HttpFaultResolver>>, Int32, String, String, Uri, Func<Exception, Boolean>)

Adds a new HttpExceptionDescriptor to the enclosed IList{FaultResolver} of the decorator from the parameters provided.

public static IDecorator<IList<HttpFaultResolver>> AddHttpFaultResolver<T>(this IDecorator<IList<HttpFaultResolver>> decorator, int statusCode, string code = null, string message = null, Uri helpLink = null, Func<Exception, bool> exceptionValidator = null)
    where T : Exception

Parameters

decorator IDecorator<IList<HttpFaultResolver>>

The IDecorator<T> to extend.

statusCode Int32

The status code of the HTTP request.

code String

The error code that uniquely identifies the type of failure.

message String

The message that explains the reason for the failure.

helpLink Uri

The optional link to a help page associated with this failure.

exceptionValidator Func<Exception, Boolean>

The function delegate that evaluates an System.Exception.

Returns

IDecorator<IList<HttpFaultResolver>>

The IDecorator{IList{FaultResolver}} instance.

Type Parameters

T

The type of the System.Exception to associate with a HttpFaultResolver.

Remarks

The following table shows the initial property values for the added instance of HttpExceptionDescriptor.

ParameterInitial Value
codecode ?? ReasonPhrases.GetReasonPhrase(statusCode)
messagemessage ?? failure.Message

Exceptions

System.ArgumentNullException

decorator cannot be null.

AddHttpFaultResolver<T>(IDecorator<IList<HttpFaultResolver>>, String, Uri, Func<Exception, Boolean>)

Adds a new HttpExceptionDescriptor to the enclosed IList{FaultResolver} of the decorator from the parameters provided.

public static IDecorator<IList<HttpFaultResolver>> AddHttpFaultResolver<T>(this IDecorator<IList<HttpFaultResolver>> decorator, string message = null, Uri helpLink = null, Func<Exception, bool> exceptionValidator = null)
    where T : HttpStatusCodeException

Parameters

decorator IDecorator<IList<HttpFaultResolver>>

The IDecorator<T> to extend.

message String

The message that explains the reason for the failure.

helpLink Uri

The optional link to a help page associated with this failure.

exceptionValidator Func<Exception, Boolean>

The function delegate that evaluates an System.Exception.

Returns

IDecorator<IList<HttpFaultResolver>>

The IDecorator{IList{FaultResolver}} instance.

Type Parameters

T

The type of the HttpStatusCodeException to associate with a HttpFaultResolver.

Remarks

The following table shows the initial property values for the added instance of HttpExceptionDescriptor.

ParameterInitial Value
messagemessage ?? failure.Message

Exceptions

System.ArgumentNullException

decorator cannot be null.

See Also