Why it is not recommended to raise 'RuntimeException'

I am referring to: http://documentation.xojo.com/index.php/Exception

It says:
Sub …

Exception err as TypeMismatchException
MsgBox “Tried to retype an object!”
Exception err as NilObjectException
MsgBox “Tried to access a Nil object!”
Exception err as RuntimeException // NOT RECOMMENDED
MsgBox “Another exception”

Thanks in advance.

RuntimeException is VERY generic
You’d be better off to declare your own subclasses & raise those so you have a better idea of what went wrong
For instance TypeMismatchException is a subclass of RuntimeException and gives you more information that “hey something went wrong”

It doesn’t say that it’s not recommended to raise RuntimeException, even if it’s not recommend indeed ( see Norman’s post ). It says that it’s not recommended to catch RuntimeException. Read the sentence right above the code example, and the note just above the code example which explains why.

Xojo uses special exception subclasses (EndException and ThreadEndException) to signal that the app is quitting or a thread is ending, respectively.

An exception block that catches RuntimeException will catch all exception types that are Raised to the exception/catch block. You should not use RuntimeException in an exception/catch block because ThreadEndException and EndException will also be caught and that’s a Bad Thing.

If you use such a catchall exception block then you must be sure to re-raise EndException and ThreadEndException:

Exception Err As RuntimeException If Err IsA EndException Or Err IsA ThreadEndException Then Raise err ' error handling here