Class HttpFaultResolverExtensions
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc.Filters.Diagnostics
- Assembly
- Cuemon.Extensions.AspNetCore.Mvc.dll
Extension methods for the HttpFaultResolver class.
public static class HttpFaultResolverExtensions
- Inheritance
-
HttpFaultResolverExtensions
Methods
AddHttpFaultResolver<T>(IList<HttpFaultResolver>, Func<T, HttpExceptionDescriptor>, Func<Exception, bool>)
Adds the specified function delegate exceptionDescriptorResolver and function delegate exceptionValidator to the collection of descriptors.
public static IList<HttpFaultResolver> AddHttpFaultResolver<T>(this IList<HttpFaultResolver> descriptors, Func<T, HttpExceptionDescriptor> exceptionDescriptorResolver, Func<Exception, bool> exceptionValidator) where T : Exception
Parameters
descriptorsIList<HttpFaultResolver>The collection to extend.
exceptionDescriptorResolverFunc<T, HttpExceptionDescriptor>The function delegate that associates an Exception of type
Twith an HttpExceptionDescriptor.exceptionValidatorFunc<Exception, bool>The function delegate that evaluates an Exception.
Returns
- IList<HttpFaultResolver>
A reference to this instance after the operation has completed.
Type Parameters
TThe type of the Exception to associate with a HttpFaultResolver.
Exceptions
- ArgumentNullException
descriptorsis null.
AddHttpFaultResolver<T>(IList<HttpFaultResolver>, int, string, string, Uri, Func<Exception, bool>)
Adds a new HttpExceptionDescriptor to the collection of descriptors from the parameters provided.
public static IList<HttpFaultResolver> AddHttpFaultResolver<T>(this IList<HttpFaultResolver> descriptors, int statusCode, string code = null, string message = null, Uri helpLink = null, Func<Exception, bool> exceptionValidator = null) where T : Exception
Parameters
descriptorsIList<HttpFaultResolver>The collection to extend.
statusCodeintThe status code of the HTTP request.
codestringThe error code that uniquely identifies the type of failure.
messagestringThe message that explains the reason for the failure.
helpLinkUriThe optional link to a help page associated with this failure.
exceptionValidatorFunc<Exception, bool>The function delegate that evaluates an Exception.
Returns
- IList<HttpFaultResolver>
A reference to this instance after the operation has completed.
Type Parameters
TThe type of the Exception to associate with a HttpFaultResolver.
Remarks
The following table shows the initial property values for the added instance of HttpExceptionDescriptor.
| Parameter | Initial Value |
|---|---|
code | code ?? ReasonPhrases.GetReasonPhrase(statusCode) |
message | message ?? failure.Message |
Exceptions
- ArgumentNullException
descriptorsis null.
AddHttpFaultResolver<T>(IList<HttpFaultResolver>, string, Uri, Func<Exception, bool>)
Adds a new HttpExceptionDescriptor to the collection of descriptors from the parameters provided.
public static IList<HttpFaultResolver> AddHttpFaultResolver<T>(this IList<HttpFaultResolver> descriptors, string message = null, Uri helpLink = null, Func<Exception, bool> exceptionValidator = null) where T : HttpStatusCodeException
Parameters
descriptorsIList<HttpFaultResolver>The collection to extend.
messagestringThe message that explains the reason for the failure.
helpLinkUriThe optional link to a help page associated with this failure.
exceptionValidatorFunc<Exception, bool>The function delegate that evaluates an Exception.
Returns
- IList<HttpFaultResolver>
A reference to this instance after the operation has completed.
Type Parameters
TThe type of the HttpStatusCodeException to associate with a HttpFaultResolver.
Remarks
The following table shows the initial property values for the added instance of HttpExceptionDescriptor.
| Parameter | Initial Value |
|---|---|
message | message ?? failure.Message |
Exceptions
- ArgumentNullException
descriptorsis null.