emitsError function

StreamMatcher emitsError (dynamic matcher)

Returns a StreamMatcher that matches a single error event that matches matcher.

Implementation

StreamMatcher emitsError(matcher) {
  var wrapped = wrapMatcher(matcher);
  var matcherDescription = wrapped.describe(StringDescription());
  var throwsMatcher = throwsA(wrapped) as AsyncMatcher;

  return StreamMatcher(
      (queue) => throwsMatcher.matchAsync(queue.next) as Future<String>,
      // TODO(nweiz): add "should" once matcher#42 is fixed.
      "emit an error that $matcherDescription");
}