New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
please add ability to get a stacktrace from errors and exceptions #112
Comments
I had the same problem, where some long scripts would be extremely hard to debug. What we did is wrap var engine = new Engine();
try
{
engine.Execute("some code that throws...");
}
catch(JavaScriptException exc)
{
var location = engine.GetLastSyntaxNode().Location.Start;
throw new ApplicationException(
String.Format("{0} (Line {1}, Column {2})",
exc.Error,
location.Line,
location.Column
), exc);
} Note that it would be much better if the |
Thanks, that is very helpful. I still think it would be very valuable to have a stacktrace available. The reason is that (in my case) the script is dynamically assembled, so getting from a line number to the actual line in the dynamic script takes a little extra work. |
For some parsing errors I encountered also the
|
I'm building an engine that uses Jint to execute a javascript file with a bunch of functions.
The problem is that if there is
all you get out of Jint is a JavaScriptException with no context as to where the error occurred.
Right now I'm relegated to adding log statements just to find the problem in the script.
It would be extremely helpful if any throwing of Error() would come with the stack property filled in with the stacktrace of the js functions.
The text was updated successfully, but these errors were encountered: