QUIT argument not allowed
try{ .... .... .... Set tSC = method_invocation() If $$$ISERR(tSC) { Quit tSC } .... .... .... }
On compiling the above, I get an error saying "QUIT argument not allowed : 'tSC' ".
- When I replace Quit tSC with Return tSC, it compiles
- On replacing Quit tSC with Quit $$$OK, I get the error: QUIT argument not allowed : '1'
- On replacing Quit tSC with Quit, it compiles
- A 'Quit tSC' statement outside of the try-catch block does not cause a compile-time error.
The reason this happens is because a 'Quit' inside a try-catch block causes control to be passed to the code immediately outside the try catch block instead of quitting the function and returning a value.
Sharing this here because it took me a while to realize what was happening (and although something related is briefly mentioned in the try-catch docs, I could only find it after I realized that the problem was related to try-catch)