private JsRuntimeException ConvertRecursionDepthOverflowExceptionToJsRuntimeException( OriginalRecursionDepthOverflowException jsRecursionException) { string message = string.Format(Strings.Runtime_RecursionDepthOverflow, jsRecursionException.CallChain); var jsRuntimeException = new JsRuntimeException(message, EngineName, EngineVersion, jsRecursionException) { Category = "RecursionDepthOverflowError" }; return(jsRuntimeException); }
private JsRuntimeException ConvertRecursionDepthOverflowExceptionToJsRuntimeException( OriginalRecursionDepthOverflowException jsRecursionException) { string message = string.Format(Strings.Runtime_RecursionDepthOverflow, jsRecursionException.CallChain); var jsRuntimeException = new JsRuntimeException(message, ENGINE_NAME, ENGINE_VERSION, jsRecursionException) { Category = "RecursionDepthOverflowError", Source = jsRecursionException.Source, HelpLink = jsRecursionException.HelpLink }; return(jsRuntimeException); }
private static WrapperRuntimeException WrapRecursionDepthOverflowException( OriginalRecursionDepthOverflowException originalRecursionException) { string callStack = string.Empty; string[] callChainItems = originalRecursionException.CallChain .Split(new string[] { "->" }, StringSplitOptions.None) ; if (callChainItems.Length > 0) { var stringBuilderPool = StringBuilderPool.Shared; StringBuilder stackBuilder = stringBuilderPool.Rent(); for (int chainItemIndex = callChainItems.Length - 1; chainItemIndex >= 0; chainItemIndex--) { string chainItem = callChainItems[chainItemIndex]; if (chainItem == "anonymous function") { chainItem = "Anonymous function"; } JsErrorHelpers.WriteErrorLocationLine(stackBuilder, chainItem, string.Empty, 0, 0); if (chainItemIndex > 0) { stackBuilder.AppendLine(); } } callStack = stackBuilder.ToString(); stringBuilderPool.Return(stackBuilder); } string description = originalRecursionException.Message; string type = JsErrorType.Range; string message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, callStack); var wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, originalRecursionException) { Description = description, Type = type, CallStack = callStack }; return(wrapperRuntimeException); }