groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chandler Lv <magica...@gmail.com>
Subject Cannot get line number through ScriptException
Date Mon, 15 May 2017 02:44:38 GMT
Hi all,

I use groovy in my java application. With JSR223, first compile, then eval.
Everything is good except for one thing. It looks like that I cannot get
the line number through catching ScriptException when there is something
wrong with my scripts.

So I checkout the source code. In GroovyScriptEngineImpl#eval(),

...
} catch (Exception e) {
      throw new ScriptException(e);
} finally {
...

The constructor code is:
public ScriptException(Exception e) {
        super(e);
        fileName = null;
        lineNumber = -1;
        columnNumber = -1;
}

So my question is, how to get the line number through ScriptException or
any other way with JSR223 implementation.

Thanks,
zehui lv

Mime
View raw message