Common script compilation errors
When you use compiled scripts, a script can be saved in the script console only if it compiles correctly. If there is an error, check the svc.out file in the appsvr logs directory for the full Java™ output and error message.
Error | Incorrect script | Correct script |
---|---|---|
A break or return statement inside a forEach*Element() block does not compile due to an "unreachable code" error. |
|
|
If you return a value from a function, you need to return a value in every
case. The incorrect script example does not return a value if an exception happens in the
catchError block. |
|
|
For major compilation issues, you can look at the generated Java files. The generated Java files are in a directory that is specified by the tmp_dir parameter in the common.properties file. The Java file naming convention includes the script name and a generated sequence, for example, MyScript12345.java.
The full path of the script from the docstore is placed as a comment at the starting of each generated Java file. If you are mapping the docstore to the file system, you can do a recursive grep to determine which Java file matches a script.