ErrObject.GetException Método

Definição

Retorna a exceção que representa o erro ocorrido.Returns the exception representing the error that occurred.

public:
 Exception ^ GetException();
public Exception? GetException ();
public Exception GetException ();
member this.GetException : unit -> Exception
Public Function GetException () As Exception

Retornos

Exception

A exceção que representa o erro ocorrido.The exception representing the error that occurred.

Exemplos

O código a seguir exibe a mensagem atribuída à exceção no Err objeto:The following code displays the message assigned to the exception in the Err object:

On Error Resume Next
Dim myError As System.Exception
' Generate an overflow exception.
Err.Raise(6)
' Assigns the exception from the Err object to myError.
myError = Err.GetException()
' Displays the message associated with the exception.
MsgBox(myError.Message)

Comentários

A GetException função está disponível somente na Err classe de objeto.The GetException function is available only from the Err object class. Ele funciona com a Exception Propriedade do Err objeto para exibir o erro que ocorreu.It works with the Exception property of the Err object to display the error that has occurred.

Aplica-se a

Confira também