public Object evaluate ( final String script , final String sourceName ) { notNull ( script ) ; // make sure we have a context associated with current thread try { return getContext ( ) . evaluateString ( scope , script , sourceName , 1 , null ) ; } catch ( final RhinoException e ) { final String message = RhinoUtils . createExceptionMessage ( e ) ; LOG . error ( "JavaScriptException occured: {}" , message ) ; throw new WroRuntimeException ( message ) ; } finally { // Rhino throws an exception when trying to exit twice. Make sure we don't get any exception if ( Context . getCurrentContext ( ) != null ) { Context . exit ( ) ; } } }
Evaluates a script .