N
Nicolas George
Hi.
I have the following piece of code:
var code = <some code from the user>;
eval(code);
If there is a syntax error in the evaluated code, the "error console" of
Firefox is able to pinpoint the exact location of the error. Firebug does
that also.
I would like to display the error in the web page.
If I catch the SyntaxError exception in the eval and print it as a string, I
get the helpful message ("missing ; before statement" for example), but not
the exact location. The stack property of the exception is not accurate
enough.
I also tried to add chrome://global/content/console.xul in an iframe, but
"security reasons" prevent it.
Does anyone have an idea to make the error message more helpful? A
Firefox-specific solution is ok for me.
Thanks.
I have the following piece of code:
var code = <some code from the user>;
eval(code);
If there is a syntax error in the evaluated code, the "error console" of
Firefox is able to pinpoint the exact location of the error. Firebug does
that also.
I would like to display the error in the web page.
If I catch the SyntaxError exception in the eval and print it as a string, I
get the helpful message ("missing ; before statement" for example), but not
the exact location. The stack property of the exception is not accurate
enough.
I also tried to add chrome://global/content/console.xul in an iframe, but
"security reasons" prevent it.
Does anyone have an idea to make the error message more helpful? A
Firefox-specific solution is ok for me.
Thanks.