Application.UnhandledException

From Xojo Documentation

Event


Application.UnhandledException(error As RuntimeException) As Boolean

Supported for all project types and targets.

If a RuntimeException is not caught anywhere else (using Exception or Try...Catch), this event is called so you may handle the exception. Return True to suppress the quit behavior. Return False to use the default quit behavior.

Notes

If a RuntimeException is not caught anywhere else, this event is called so you may handle the exception. See the example.

Sample code

This code in the UnhandledException event of the App class catches any unhanded exceptions and displays the name of the exception along with the error stack:

If error <> Nil Then
Var type As String = Introspection.GetType(error).Name
MessageBox(type + EndOfLine + EndOfLine + Join(error.Stack, EndOfLine))
End If