Class ExceptionExtensions
Summary description for ExceptionExtensions.
Inheritance
System.Object
ExceptionExtensions
Namespace: ImageVault.Common.Lib
Assembly: ImageVault.Common.dll
Syntax
public static class ExceptionExtensions : Object
Methods
FindException<T>(Exception)
Finds an exception of the supplied type. Parses the InnnerException tree until a match is found.
Declaration
public static T FindException<T>(this Exception e)
where T : Exception
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e | The System.Exception to look in |
Returns
Type | Description |
---|---|
T | The found exception or null if no matching exception was found |
Type Parameters
Name | Description |
---|---|
T | The exception type to search for. |
FindSqlError(SqlException, Int32)
Finds a matching error in the supplied SqlException
Declaration
public static SqlError FindSqlError(this SqlException e, int errorNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Data.SqlClient.SqlException | e | The System.Data.SqlClient.SqlException to search in |
System.Int32 | errorNumber | The error number to look for |
Returns
Type | Description |
---|---|
System.Data.SqlClient.SqlError | The found System.Data.SqlClient.SqlError or null. |
FindSqlError(Exception, Int32)
Finds a matching error in the supplied Exception
Declaration
public static SqlError FindSqlError(this Exception e, int errorNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e | |
System.Int32 | errorNumber |
Returns
Type | Description |
---|---|
System.Data.SqlClient.SqlError |
ToFullExceptionString(Exception)
Creates a string of the exception that is a combination of all inner exceptions found, plus the stacktrace
Declaration
public static string ToFullExceptionString(this Exception e)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e |
Returns
Type | Description |
---|---|
System.String |
ToSimpleExceptionString(Exception)
Generates a simpler message stating the message and type of the exception
Declaration
public static string ToSimpleExceptionString(this Exception e)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e |
Returns
Type | Description |
---|---|
System.String |