Information.IsError(Object) 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.
Returns a Boolean
value indicating whether an expression is an exception type.
public:
static bool IsError(System::Object ^ Expression);
public static bool IsError (object? Expression);
public static bool IsError (object Expression);
static member IsError : obj -> bool
Public Function IsError (Expression As Object) As Boolean
Parameters
- Expression
- Object
Required. Object
expression.
Returns
Returns a Boolean
value indicating whether an expression is an exception type.
Examples
The following example uses the IsError
function to check if an expression represents a system exception.
Sub demonstrateIsError(ByVal firstArg As Integer)
Dim returnVal As New Object
Dim badArg As String = "Bad argument value"
Dim errorCheck As Boolean
If firstArg > 10000 Then
returnVal = New System.ArgumentOutOfRangeException(badArg)
End If
errorCheck = IsError(returnVal)
End Sub
Remarks
IsError
returns True
if the expression represents an Object
variable that derives from the Exception class in the System namespace.
An exception that derives from System.Exception can be caught with the Try...Catch...Finally
statements.