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); } }); }
public static IWaitable Catch(this IWaitable self, Action callback) { if (callback == null) { return(self); } return(self.Catch(e => callback())); }
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); }
public static IWaitable Finally(this IWaitable self, Action callback) { if (callback == null) { return(self); } self.Then(callback); self.Catch(callback); return(self); }
public IWaitable Catch(Action <Exception> callback) { return(waitable.Catch(callback)); }