I think there are two issues here.
1. Is the ability to throw a user-defined exception. This has been discussed previously
https://4js.com/support/issue/?id=FGL-4064 and whilst not ruled out entirely, it was said that if this was going to happen the keyword would probably be THROW and not RAISE, presumably to avoid confusion with the existing WHENEVER ANY ERROR RAISE. It would require an option to populate SQLCA.SQLERRM so something like
THROW -9000 WITH "My exception text"
Part of the reasoning that saw this not implemented was consider case of CALL foo(bar()), if you throw exception in bar() should foo() be evaluated?
However looking at your example, I wonder if we allowed THROW only inside a TRY, would that alleviate our concerns? Were you expecting it to be used outside of a TRY?
2. Having CATCH handle different exceptions and also have a catch-call FINALLY . This can be achieved simply by doing a CASE STATUS as first line of CATCH e.g.
TRY
DISPLAY 1/0
CATCH
CASE STATUS
WHEN -1202
DISPLAY "Divide by zero error"
OTHERWISE
DISPLAY "Some other error"
END CASE
END TRY
you could argue that internally the compiler could convert the following to that. Is the additional syntax necessary if you adopt the above pattern?
TRY
DISPLAY 1/0
CATCH -1202
DISPLAY "Divide by zero error"
FINALLY
DISPLAY "Some other error"
END TRY
Reuben