コード例 #1
0
 public void SetExceptionHandler(ExceptionHandlerDelegate pMethod)
 {
     Monitor.Enter(this);
     if (m_delegateExceptionHandler == null)
     {
         m_delegateExceptionHandler = pMethod;
     }
     Monitor.Exit(this);
 }
コード例 #2
0
 public void Reset()
 {
     Stop();
     enumerator       = null;
     parent           = null;
     returnValue      = null;
     error            = null;
     context          = null;
     exceptionHandler = null;
 }
コード例 #3
0
        }                            //Use Routine.Create()

        private void Setup(IEnumerator enumerator, Routine parent, Object context, ExceptionHandlerDelegate exceptionHandler, System.Action onStop = null)
        {
            id = nextId++;
            Assert.IsTrue(nextId != ulong.MaxValue);
            returnValue = null;
            if (parent != null)
            {
                this.parent = parent;
            }
            this.enumerator       = enumerator;
            this.context          = context;
            this.exceptionHandler = exceptionHandler ?? Debug.LogException;
            this.onStop           = onStop;
        }
 internal static bool HandleAggregateException(Exception exception, ExceptionHandlerDelegate exceptionHandler, out ExceptionHandlingResult result)
 {
     if (!(exception is AggregateException))
     {
         return exceptionHandler(exception, out result);
     }
     var ex = (AggregateException)exception;
     foreach (var current in ex.InnerExceptions)
     {
         if (HandleAggregateException(current, exceptionHandler, out result))
         {
             return true;
         }
     }
     result = null;
     return false;
 }
コード例 #5
0
        public static T Try <T>(int howHard, Func <T> createFunc, ExceptionHandlerDelegate exceptionHandler)
        {
            var failCount = 0;

            while (true)
            {
                try
                {
                    return(createFunc());
                }
                catch (Exception e)
                {
                    failCount++;
                    var timeToThrow = failCount >= howHard;
                    exceptionHandler?.Invoke(e, failCount, howHard, timeToThrow);
                    if (timeToThrow)
                    {
                        throw;
                    }
                }
            }
        }
コード例 #6
0
        public static void Try(int howHard, Action createAction, ExceptionHandlerDelegate exceptionHandler)
        {
            var failCount = 0;

            while (true)
            {
                try
                {
                    createAction();
                    return;
                }
                catch (Exception e)
                {
                    failCount++;
                    var timeToThrow = failCount >= howHard;
                    exceptionHandler?.Invoke(e, failCount, howHard, timeToThrow);
                    if (timeToThrow)
                    {
                        throw;
                    }
                }
            }
        }
コード例 #7
0
 public ApiGlobalExceptioinFilter(ExceptionHandlerDelegate exceptionHandler)
 {
     ExceptionHandler = exceptionHandler;
 }
コード例 #8
0
 public void Start(IEnumerable enumerable, Object context = null, ExceptionHandlerDelegate exceptionHandler = null, System.Action onStop = null)
 {
     Stop();
     Setup(enumerable.GetEnumerator(), null, context, exceptionHandler, onStop);
     Step();
 }
コード例 #9
0
ファイル: Options.Extensions.cs プロジェクト: KurtGokhan/jint
 public static Options CatchClrExceptions(this Options options, ExceptionHandlerDelegate handler)
 {
     options.Interop.ExceptionHandler = handler;
     return(options);
 }