// internal static void _addErrorWithReplacement <T>(_EventSink <T> sink, Exception error, string stackTrace) { AsyncError replacement = Zone.current.errorCallback(error); if (replacement != null) { error = async_._nonNullError(replacement); stackTrace = replacement.StackTrace; } sink._addError(error, stackTrace); }
internal override void _handleData(S inputEvent, _EventSink <T> sink) { try { foreach (T value in _expand(inputEvent)) { sink._add(value); } } catch (Exception e) { // If either _expand or iterating the generated iterator throws, // we abort the iteration. _stream._addErrorWithReplacement(sink, e, e.StackTrace); } }
internal override void _handleData(S inputEvent, _EventSink <T> sink) { T outputEvent; try { outputEvent = _transform(inputEvent); } catch (Exception e) { _stream._addErrorWithReplacement(sink, e, e.StackTrace); return; } sink._add(outputEvent); }
public WebBrowserEvents(WebBrowser browser) { if (browser.Document == null) { throw new InvalidOperationException("Can't add an event sink until the browser's document is non-null"); } var serviceProvider = (IServiceProvider)browser.Document; var serviceGuid = new Guid(SID.SWebBrowserApp); var iid = new Guid(IID.ConnectionPointContainer); var cpc = (IConnectionPointContainer)serviceProvider.QueryService(ref serviceGuid, ref iid); _sink = new _EventSink(this); _cookie = new SafeConnectionPointCookie(cpc, _sink, new Guid(IID.WebBrowserEvents2)); }
internal override void _handleData(T inputEvent, _EventSink <T> sink) { bool satisfies; try { satisfies = _test(inputEvent); } catch (Exception e) { _stream._addErrorWithReplacement(sink, e, e.StackTrace); return; } if (satisfies) { sink._add(inputEvent); } }
internal override void _handleData(T inputEvent, _EventSink <T> sink) { _StateStreamSubscription <T> subscription = (_StateStreamSubscription <T>)sink; int count = subscription._count; if (count > 0) { sink._add(inputEvent); count -= 1; subscription._count = count; if (count == 0) { // Closing also unsubscribes all subscribers, which unsubscribes // this from source. sink._close(); } } }
internal override void _handleError(object error, _EventSink <T> sink) { bool matches = true; if (_test != null) { try { matches = _test((Exception)error); } catch (Exception e) { _stream._addErrorWithReplacement(sink, e, e.StackTrace); return; } } string stackTrace = error is Exception ? ((Exception)error).StackTrace : ""; if (matches) { try { _async._invokeErrorHandler(_transform, error, stackTrace); } catch (Exception e) { if (Equals(e, error)) { sink._addError(error, stackTrace); } else { _stream._addErrorWithReplacement(sink, e, e.StackTrace); } return; } } else { sink._addError(error, stackTrace); } }
internal _EventSinkWrapper(_EventSink <T> _sink) { this._sink = _sink; }
internal virtual void _handleDone(_EventSink <T> sink) { sink._close(); }
internal virtual void _handleError(object error, _EventSink <T> sink) { string stackTrace = error is Exception ? ((Exception)error).StackTrace : ""; sink._addError(error, stackTrace); }
// Override the following methods in subclasses to change the behavior. internal virtual void _handleData(S data, _EventSink <T> sink) { sink._add((T)(object)data); }