Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JS: explaining an error in eval

0 views
Skip to first unread message

Nicolas George

unread,
Jan 7, 2010, 9:46:45 AM1/7/10
to
[ This question is about JavaScript that will run in Firefox. I expect it
somewhat beyond the scope of this newsgroup, but I did not manage to find
one more adapted. If you have pointers, they are welcome. ]

I have the following piece of code:

var program = <some code from the user>;
try {
eval(program);
} catch(e) {
alert("Your program has a problem: " + e);
}

I would like to print something more helpful to describe the error,
especially the exact point where it happens. I have examined the SyntaxError
exception object, but I did not find anything useful. The Error Console and
Firebug manage to be more helpful.

Does anyone here know how to do it?

Thanks.

--
Nicolas George

Beauregard T. Shagnasty

unread,
Jan 7, 2010, 12:34:39 PM1/7/10
to
Nicolas George wrote:

> [ This question is about JavaScript that will run in Firefox. I expect
> it somewhat beyond the scope of this newsgroup, but I did not manage
> to find one more adapted. If you have pointers, they are welcome. ]

comp.lang.javascript should help you.

--
-bts
-Four wheels carry the body; two wheels move the soul

0 new messages