Beispiel #1
0
        public override void handleNext(_EventDispatch <T> dispatch)
        {
            if (_iterator == null)
            {
                throw new Exception("No events pending.");
            }

            bool?hasMore = null;

            try {
                hasMore = _iterator.MoveNext();
                if (hasMore ?? false)
                {
                    dispatch._sendData(_iterator.Current);
                }
                else
                {
                    _iterator = null;
                    dispatch._sendDone();
                }
            }
            catch (Exception e) {
                if (hasMore == null)
                {
                    // Threw in .moveNext().
                    // Ensure that we send a done afterwards.
                    _iterator = Enumerable.Empty <T>().GetEnumerator(); // new EmptyIterator<Null>();
                    dispatch._sendError(e, e.StackTrace);
                }
                else
                {
                    // Threw in .current.
                    dispatch._sendError(e, e.StackTrace);
                }
            }
        }
Beispiel #2
0
 public override void perform(_EventDispatch <T> dispatch)
 {
     dispatch._sendError(error, stackTrace);
 }