Example: Testing Parameter Values
The following script tests that the value of the parameter parm1
is between 0.0 and 100.0 and throws an exception if it is not, causing
the whole component to fail. The parameter parm2
is checked separately
for being between 0.09 and 15.0 (0.09 < parm2
< 15.0 is a Jython shorthand for 0.09 < parm2
and parm2
< 15.0).
new
operator is not used when creating
a new instance of a Java class like RtException
.from com.engineous.sdk.runtime import RtException if parm1 <= 0.0 or parm1 >= 100.0 : raise RtException("Parameter parm1 is out of range") if not (0.09 < parm2 < 15.0): raise RtException("Parameter parm2 is out of range")