ErrorHandler.ExceptionToHResult(Exception, Boolean) Method

Definition

Convert the given Exception into a COM HRESULT return code and set the COM error info on the calling thread. Optionally, report that error to the user.

public static int ExceptionToHResult (Exception ex, bool reportError = false);
static member ExceptionToHResult : Exception * bool -> int
Public Shared Function ExceptionToHResult (ex As Exception, Optional reportError As Boolean = false) As Integer

Parameters

ex
Exception

The exception to convert.

reportError
Boolean

If true, then the error is reported to the user.

Returns

The HRESULT of the converted exception.

Applies to