Table of Contents

Class FaultHandler<TDescriptor>

Namespace
Cuemon.Diagnostics
Assembly
Cuemon.Diagnostics.dll

Provides a generic way to implement a fault resolver that evaluate an exception and provide details about it in a developer friendly way.

public abstract class FaultHandler<TDescriptor>
    where TDescriptor : ExceptionDescriptor

Type Parameters

TDescriptor
Inheritance
FaultHandler<TDescriptor>
Derived

Constructors

FaultHandler(Func<Exception, Boolean>, Func<Exception, TDescriptor>)

Initializes a new instance of the FaultResolver class.

protected FaultHandler(Func<Exception, bool> validator, Func<Exception, TDescriptor> descriptor)

Parameters

validator Func<Exception, Boolean>

The function delegate that evaluates an Exception.

descriptor Func<Exception, TDescriptor>

The function delegate that provides details about an Exception.

Exceptions

ArgumentNullException

validator cannot be null -or- descriptor cannot be null.

Methods

TryResolveFault(Exception, out TDescriptor)

Attempts to resolve TDescriptor from the underlying function delegates.

public bool TryResolveFault(Exception failure, out TDescriptor descriptor)

Parameters

failure Exception

The Exception that caused the current failure.

descriptor TDescriptor

The resulting TDescriptor instance providing the reason of the failure, or default.

Returns

Boolean

true if an instance of TDescriptor providing the reason for the failure is available, false otherwise.