@@ -1829,5 +1829,23 @@ namespace Jint.Tests.Runtime
");
}
+ [Fact]
+ public void ExceptionShouldHaveLocationOfInnerFunction()
+ {
+ try
+ new Engine()
+ .Execute(@"
+ function test(s) {
+ o.boom();
+ }
+ test('arg');
+ ");
+ catch (JavaScriptException ex)
+ Assert.Equal(3, ex.LineNumber);
@@ -432,7 +432,7 @@ namespace Jint.Runtime
catch(JavaScriptException v)
{
c = new Completion(Completion.Throw, v.Error, null);
- c.Location = s.Location;
+ c.Location = v.Location ?? s.Location;
return c;