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
Object
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 System.Exception.

descriptor Func<Exception, TDescriptor>

The function delegate that provides details about an System.Exception.

Exceptions

System.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 System.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.