@@ -54,7 +54,7 @@ public sealed class YantraJsEngine : JsEngineBase
5454 /// <summary>
5555 /// Version of original JS engine
5656 /// </summary>
57- private const string EngineVersion = "1.2.334 " ;
57+ private const string EngineVersion = "1.2.342 " ;
5858
5959 /// <summary>
6060 /// Regular expression for working with the error message
@@ -332,7 +332,7 @@ private WrapperException WrapJsException(OriginalException originalException)
332332 string messageWithCallStack = type == JsErrorType . Syntax ?
333333 originalException . JSStackTrace . AsStringOrDefault ( )
334334 :
335- errorValue . Stack ?? errorValue [ OriginalKeyString . stack ] . AsStringOrDefault ( )
335+ errorValue [ OriginalKeyString . stack ] . AsStringOrDefault ( )
336336 ;
337337 string rawCallStack = GetRawCallStack ( message , messageWithType , messageWithCallStack ) ;
338338
@@ -395,8 +395,18 @@ private WrapperException WrapJsException(OriginalException originalException)
395395
396396 private static string GetRawCallStack ( string message , string messageWithType , string messageWithCallStack )
397397 {
398- string baseMessage = messageWithCallStack . StartsWith ( messageWithType ) ? messageWithType : message ;
399- string rawCallStack = JsErrorHelpers . GetErrorLocationFromMessage ( messageWithCallStack , baseMessage ) ;
398+ const string errorFunctionTypePrefix = "Function: " ;
399+ string processedMessageWithCallStack = messageWithCallStack ;
400+
401+ if ( messageWithCallStack . StartsWith ( errorFunctionTypePrefix ) )
402+ {
403+ processedMessageWithCallStack = messageWithCallStack . Substring ( errorFunctionTypePrefix . Length ) ;
404+ }
405+
406+ string baseMessage = processedMessageWithCallStack . StartsWith ( messageWithType ) ?
407+ messageWithType : message ;
408+ string rawCallStack = JsErrorHelpers . GetErrorLocationFromMessage ( processedMessageWithCallStack ,
409+ baseMessage ) ;
400410
401411 return rawCallStack ;
402412 }
0 commit comments