Skip to content

Commit

Permalink
Merge pull request #1521 from benjchristensen/issue-1450
Browse files Browse the repository at this point in the history
Fix toIterator Exception Handling
  • Loading branch information
benjchristensen committed Jul 25, 2014
2 parents 41425ef + 11374c2 commit eccbe4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void onCompleted() {

@Override
public void onError(Throwable e) {
// ignore
notifications.offer(Notification.<T>createOnError(e));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,18 @@ public void call(Subscriber<? super String> observer) {
assertEquals(true, it.hasNext());
it.next();
}

@Test(expected = TestException.class)
public void testExceptionThrownFromOnSubscribe() {
Iterable<String> strings = Observable.create(new Observable.OnSubscribe<String>() {
@Override
public void call(Subscriber<? super String> subscriber) {
throw new TestException("intentional");
}
}).toBlocking().toIterable();
for (String string : strings) {
// never reaches here
System.out.println(string);
}
}
}

0 comments on commit eccbe4c

Please sign in to comment.