RecursionDepthOverflowException.cs 755 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Jint.Native;
  5. using Jint.Parser.Ast;
  6. namespace Jint.Runtime
  7. {
  8. public class RecursionDepthOverflowException : Exception
  9. {
  10. public string CallChain { get; private set; }
  11. public string CallExpressionReference { get; private set; }
  12. public RecursionDepthOverflowException(Stack<Tuple<CallExpression, JsValue, string>> currentStack, Tuple<CallExpression, JsValue, string> currentExpression)
  13. : base("The recursion is forbidden by script host.")
  14. {
  15. CallExpressionReference = currentExpression.Item3;
  16. CallChain = string.Join("->", currentStack.Select(t => t.Item3).ToArray().Reverse());
  17. }
  18. }
  19. }