Class ExceptionUtilityExtensions
This is an extension implementation of the most common methods on the ExceptionUtility class.
Inheritance
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class ExceptionUtilityExtensions
Methods
| Improve this DocFlatten(Exception)
Flattens any inner exceptions descendant-or-self from the specified exception into an System.Collections.Generic.IEnumerable<T> sequence of exceptions.
Declaration
public static IEnumerable<Exception> Flatten(this Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The exception to flatten. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Exception> | An empty System.Collections.Generic.IEnumerable<T> sequence if no inner exceptions was specified; otherwise any inner exceptions rooted to the specified |
Remarks
If any inner exceptions are referenced this method will iterative flatten all of them descendant-or-self from the specified exception.
Should the exception be of the new AggregateException type introduced with .NET 4.0, the return sequence of this method will be equal to the result of the InnerExceptions property.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
Flatten(Exception, Type)
Flattens any inner exceptions descendant-or-self from the specified exception into an System.Collections.Generic.IEnumerable<T> sequence of exceptions.
Declaration
public static IEnumerable<Exception> Flatten(this Exception exception, Type exceptionType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The exception to flatten. |
| System.Type | exceptionType | The type of the specified |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Exception> | An empty System.Collections.Generic.IEnumerable<T> sequence if no inner exceptions was referenced; otherwise any inner exceptions descendant-or-self from the specified |
Remarks
If any inner exceptions are referenced this method will iterative flatten all of them descendant-or-self from the specified exception.
Should the exception be of the new AggregateException type introduced with .NET 4.0, the return sequence of this method will be equal to the result of the InnerExceptions property.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
ParseException<TResult>(Exception)
Parses the specified exception for a match on TResult.
Declaration
public static TResult ParseException<TResult>(this Exception exception)
where TResult : Exception
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The exception to parse for a match on |
Returns
| Type | Description |
|---|---|
| TResult | The matched |
Type Parameters
| Name | Description |
|---|---|
| TResult | The type of the |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
Refine(Exception, MethodDescriptor, Object[])
Refines the specified exception with valuable meta information extracted from the associated method and parameters.
Declaration
public static MethodWrappedException Refine(this Exception exception, MethodDescriptor method, params object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The exception that needs to be thrown. |
| MethodDescriptor | method | The method signature containing valuable meta information. |
| System.Object[] | parameters | The optional parameters to accompany |
Returns
| Type | Description |
|---|---|
| MethodWrappedException | The specified |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
Refine(Exception, MethodBase, Object[])
Refines the specified exception with valuable meta information extracted from the associated method and parameters.
Declaration
public static MethodWrappedException Refine(this Exception exception, MethodBase method, params object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The exception that needs to be thrown. |
| System.Reflection.MethodBase | method | The method to extract valuable meta information from. |
| System.Object[] | parameters | The optional parameters to accompany |
Returns
| Type | Description |
|---|---|
| MethodWrappedException | The specified |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
Unwrap(MethodWrappedException)
Unwraps the specified wrappedException.
Declaration
public static Exception Unwrap(this MethodWrappedException wrappedException)
Parameters
| Type | Name | Description |
|---|---|---|
| MethodWrappedException | wrappedException | The wrapped exception to unwrap. |
Returns
| Type | Description |
|---|---|
| System.Exception | The originating exception from within MethodWrappedException. |