예제 #1
0
        private void NextCatch()
        {
            var tid = Thread.CurrentThread.ManagedThreadId;

            waitable.Catch(e =>
            {
                if (Status != WaitableStatus.Running)
                {
                    return;
                }

                var fastCall = tid == Thread.CurrentThread.ManagedThreadId;
                waitable     = null;

                if (waitable is ICompleteCoroutineWaitable)
                {
                    Enqueue(() => Fail(e), fastCall);
                }
                else
                {
                    //等待的事件失败,继续下一步,由调用者处理异常,coroutine本身未失败
                    Enqueue(NextStep, fastCall);
                }
            });
        }
예제 #2
0
 public static IWaitable Catch(this IWaitable self, Action callback)
 {
     if (callback == null)
     {
         return(self);
     }
     return(self.Catch(e => callback()));
 }
예제 #3
0
        public static IWaitable Finally(this IWaitable self, Action callback)
        {
            Assert.NotNull(self, nameof(self));
            Assert.NotNull(callback, nameof(callback));

            self.Then(callback);
            self.Catch(e => callback());
            return(self);
        }
예제 #4
0
        public static IWaitable Finally(this IWaitable self, Action callback)
        {
            if (callback == null)
            {
                return(self);
            }

            self.Then(callback);
            self.Catch(callback);
            return(self);
        }
예제 #5
0
 public IWaitable Catch(Action <Exception> callback)
 {
     return(waitable.Catch(callback));
 }