WebSession.UnhandledException

From Xojo Documentation

Event


WebSession.UnhandledException(error as RuntimeException) As Boolean

Supported for all project types and targets.

Receives otherwise missed exceptions — exceptions that could have been caught in an Exception statement using one of the Runtime exception handlers.

Notes

If the appropriate Exception statement is missing, the runtime exception error triggers this event and allows you to handle exceptions here. See the example.

Returns a Boolean. If it returns True, the standard alert indicating an unhandled exception and quit behavior are suppressed. Return False to allow the default unhandled exception error processing to occur. See the RuntimeException class.

Example

This code in the UnhandledException event of the WebSession class “catches” the unhandled OutOfBoundsException. Of course, it catches all unhandled OutOfBoundsExceptions throughout the application, so it doesn’t know where the error occurred. You could instead place an Exception statement within the PushButton’s Action event so that you can provide more specific diagnostics.

Function UnhandledException(error As RuntimeException) As Boolean
If error <> Nil Then
Var type As String = Introspection.GetType(error).Name
MsgBox(type + EndOfLine + EndOfLine + Join(error.Stack, EndOfLine)
End If
End Function