For the following a statement in a jexl script,
routeX = Telemat.locate(map, vehicle, newLatLong);
With that JEXL in the following order goes on to
- resolve Telemat.locate(map, vehicle, newLatLong).
- inquire the has('routeX'), so that my Java code knows which varname is being declared, and could feed back to JEXL if the varname already exists.
- calls the method set('routeX', <resolved value of Telemat.locate(map, vehicle, newLatLong)> )
That is, the RHS is resolved before, the has or get is called and therefore my Java code would not know the LHS varname while the RHS is evaluated.
Let's say I embedded an InAccessibleMapException cause in a RunTimeException when the map is inaccessible. And it so happens that at one instance the map was inaccessible. Which led to RunTimeException(InAccessibleMapException) being thrown.
I have try-catch
try {
jexlScript.execute(script);
} catch (RunTimeException rte) {
// but my code does not know the varname.
}
When JEXL throws the exception, my Java code needs to feedback an error message to the engineers I work for that includes the varname that caused the error in their script.
What is the best way or strategy, I could use to capture the varname, when an exception is thrown during the resolution of the RHS, so that the exception catcher could feed back the varname besides the error, in the log and error message?