On Aug 2, 10:54 pm, tlrobinson <[EMAIL PROTECTED]> wrote:
> Is there a way to get the line number of a syntax error in code that's
> executed via "eval(code)" or "new Function(code)" or equivalent?
>
> Thanks.
>From JavaScript:
js> try { eval("if (a) { \n 7; \n &&& } else 23;"); } catch (e) { ex =
e; }
SyntaxError: syntax error
js> ex.lineNumber
3
>From Java, the syntax error will result in a RhinoException being
thrown. You can call lineNumber() on the RhinoException once you catch
it.
--N
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino