Class ExceptionUtils
Exception utilities
Inherited Members
Namespace: Microsoft.Graph.Communications.Common
Assembly: Microsoft.Graph.Communications.Common.dll
Syntax
public static class ExceptionUtils
Methods
FindInnerException(Exception)
Find the inner exception that caused the error.
Declaration
public static Exception FindInnerException(this Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Top level exception. |
Returns
Type | Description |
---|---|
Exception | Inner exception causing the error. |
FormatException(Exception, Int32)
Format the exception including up to depth
inner exceptions.
Includes stack trace of the last inner exception (up to depth
).
Declaration
public static string FormatException(this Exception exception, int depth = 4)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Top level exception. |
Int32 | depth | The depth of inner exceptions, valid range is [1..4]. 1 means that most top exception will be formatted. |
Returns
Type | Description |
---|---|
String | Formatted exception |
GetBaseException(Exception)
Gets the base exception of an exception. If the exception is an AggregateException, then the inner exceptions are flattened before getting the base exception.
Declaration
public static Exception GetBaseException(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | The exception |
Returns
Type | Description |
---|---|
Exception | Whether it's base exception |