From Xojo Documentation

Class (inherits from RuntimeException)

A ThreadEndException is raised when a Thread is closing. Usually you do not see the ThreadEndException unless you use a "catch-all" Exception statement.

CallStack Message Stack
ErrorNumber Stack
CallStack Stack


NOTE: Whenever you inadvertently catch an ThreadEndException, you MUST re-raise it. Failing to do so will mess up the runtime environment and lead to unpredictable problems. See Exception statement for more information about its proper use.

An Exception block can catch a ThreadEndException when you use a catch-all exception statement, i.e. "Exception err as RuntimeException" instead of giving a more specific runtime exception class. In such a case, you MUST re-raise the exception to avoid messing up the runtime environment and create some unpredictable problems.

Exception err As RuntimeException // Will catch any exception without discrimination
If err IsA EndException Or err IsA ThreadEndException Then
Raise err // Re-raise the exception
End If

//Continue your code here

See Also

RuntimeException class; Function, Raise statements; Nil datatype; Exception, Try statements.