How can i get the the actual programm line number.
I like to programmatically display or store the number in some error cases.
Thanke you for Help
How can i get the the actual programm line number.
I like to programmatically display or store the number in some error cases.
Thanke you for Help
if you have catched the exception you can try to get the linenumber like this:
catch(e)
{
application.output(e.lineNumber);
}
Great, thanke you !
Very useful when I like to log or display a specific problem in busines logic:
I can force an error like
try { var a=nonExistingVar } catch(e) {do some log- or message-thing with ... e.lineNumber }
Now, i look for something similar if a error in code happens. I need a kind of global error method
that gives me the actual functionname and the actual linenumber where the error occurs.
Sorry for many of questions…
i dont think you have for those exceptions much more info the lineNumber and message…
jcompagner:
i dont think you have for those exceptions much more info the lineNumber and message…
Yes its true. I found a Ticket from 2006 : Ticket 61495
it is discussed at http://forum.servoy.com/viewtopic.php?f=3&t=7106
problem is that that is discussing the ServoyException, and what we do here is a pure RhinoException…
So that feature request only works for ServoyExceptions not the ones generate pure in scripting.
Ok !
Sometimes i have a hard time understanding this different layers from javascrpt to java, but its getting more clear on and on.
Thanke you
jcompagner:
if you have catched the exception you can try to get the linenumber like this:Code: Select all
catch(e)
{
application.output(e.lineNumber);
}
e.fileName gives you the actual fileName in the workspace where this error happens.
application.output('\tat ' + e.fileName + ':' + e.lineNumber)
will output a hyperlink in the console which you can use to jump directly to this specific method.
Hope this helps a bit more…
after months I found this:
e.rhinoException.getScriptStackTrace()
``` receives me the Function-Name !