ErrorHandler.ExceptionToHResult(Exception, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.