Table of Contents

Class ExceptionUtil

Namespace
Hi.Common
Assembly
HiGeom.dll

Provides utility methods for handling exceptions.

public static class ExceptionUtil
Inheritance
ExceptionUtil
Inherited Members

Methods

CatchWithSilentPass(Task, object, params Type[])

Continues the task and silently passes specified exception types.

public static Task CatchWithSilentPass(this Task task, object sender, params Type[] silentPassTypes)

Parameters

task Task

The task to continue.

sender object

The sender object.

silentPassTypes Type[]

The exception types to silently pass.

Returns

Task

A task that represents the continuation.

ShowException(Exception, object)

Shows the exception by invoking the OnShown event.

public static void ShowException(this Exception exception, object sender)

Parameters

exception Exception

The exception to show.

sender object

The sender object.

ShowIfCatched(Task, object)

Continues the task and shows any exception that occurs.

public static Task ShowIfCatched(this Task task, object sender)

Parameters

task Task

The task to continue.

sender object

The sender object.

Returns

Task

A task that represents the continuation.

ShowIfCatched<T>(Action, object)

Executes the specified action and shows any exception that occurs.

public static void ShowIfCatched<T>(this Action action, object sender = null)

Parameters

action Action

The action to execute.

sender object

The sender object.

Type Parameters

T

The type of the action.

ShowIfCatched<T>(Func<T>, object)

Executes the specified function and shows any exception that occurs.

public static T ShowIfCatched<T>(this Func<T> func, object sender = null)

Parameters

func Func<T>

The function to execute.

sender object

The sender object.

Returns

T

The result of the function, or default(T) if an exception occurs.

Type Parameters

T

The return type of the function.

Events

OnShown

On Catched or handled.

public static event EventHandler<Exception> OnShown

Event Type

EventHandler<Exception>