"abort script" statement in "try…end try" blocks…

Syntactically, we cannot use the “abort script” statement inside a “try … end try” block, which is a limitation (or may be for some logical reason) in Dex.

But most of the times, “abort script” is indeed a boon for most of the scenarios, where we need to skip the further processing of that particular script. How to overcome this?

We can simulate this “abort script” inside a “try … end try”. Check out the following code:

{regular code pieces}
if ProcessFurther = false then
throw EXCEPTION_ABORT_SCRIPT; {You can create this constant for reusability on your code with some integer value which you think is not used for any other System Exceptions}
{Proceed further}
end if;
{Handle the Exceptions}
catch [EXCEPTION_ABORT_SCRIPT] {Your own Exception defined}
{Just do nothing. This is to simulate the “abort script” functionality.}
end try;

This is an easy way to simulate the “abort script” inside a “try … end try” block.

Other possibilities are most welcome.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s