Error Handling
Script Exceptions
All exceptions thrown by any script task execution are sub types of ScriptingException.
Figure 1. ScriptingException and sub types
Script Task Abortion by Exception
The script task can throw an ScriptClientExecutionException to abort the execution of an IScriptTask, and display a
meaningful message to the user.
Stop script task execution by throwing an ScriptClientExecutionException
scriptTask("TaskName"){
code{
// Stop the execution and display a message to the user
throw new ScriptClientExecutionException("Message to the User")
}
}
Exception with Console Return Code
AnScriptClientExecutionException with an return code of type Integer will also abort the execution of the
IScriptTask.
But it also changes the return code of the console application, if the IScriptTask was executed in the console application. This could be used when the
console application of the DaVinci Configurator is called for other scripts or batch files.
Changing the return code of the console application by throwing an ScriptClientExecutionException
scriptTask("TaskName"){
code{
// The return code will be returned by the DvCmd.exe process
def returnCode = 50
throw new ScriptClientExecutionException(returnCode, "Message to the User")
}
}