Exit script is a very useful instruction to exit the execution of a script. As a example, I use it a lot instead of commenting several sections. However, it appears tthat the code is still parsed... and throws errors !!!
Especially Must-Include which is still executed.
I lost hours trying to understand why and this is everything but :
1/very dangerous 2/unnatural
Please make Make "exit script;" exiting script for real.
Best regards,
Simon
Bi Consultant (Dataviz & Dataprep) @ Business & Decision
Must_include is a dollar sign expansion of a system variable so will always take place before any script execution. Even its peer of "include" would also fail in such cases. It's objecting to the syntax of the connection, path and file rather than the underlying QVS itself.
I have seen your problem in several customer apps. It was frustrating when references to included scripts failed but you didn't care. Through due diligence, use of GIT and cleverly mapped app configuration we were able to ensure that scripts were virtually guaranteed to execute without error - especially in higher environments.
One other thing to watch out for is that if you exit the script the calling task may see this as a normal execution stop and report success. There are tricks such as wrapping the EXIT routine with a command that is syntactically incorrect etc, and others. I am sure there are loads of examples on like Qommunity to trap exceptions in clean ways but that was the approach I always took.
One other thing to watch out for is that if you exit the script the calling task may see this as a normal execution stop and report success.
I don't want exit script to generate an error, it's a perfectly legit stop 🙂
Through due diligence, use of GIT and cleverly mapped app configuration we were able to ensure that scripts were virtually guaranteed to execute without error - especially in higher environments
Actually I don't have the issue in production environment, just in development.. but as mentioned : it's not natural.
Basically when you execute a script all variable references are resolved. "Must_Include" is the same - so irrespective of any control statements or exits in the code, the Includes must work or it will abort - yes it's annoying but it's the intended behaviour. Happy to "escalate" to Qlik for you but I suspect you will receive the same.