@@ -31,6 +31,10 @@ public void onNext(Object v) {
3131 System .out .println (name + ": " + v );
3232 }
3333 }
34+
35+ public static void main (String [] args ) {
36+ new ResumeTest ().exampleOnExceptionResumeNextNoException ();
37+ }
3438
3539 public void exampleOnErrorReturn () {
3640 Observable <String > values = Observable .create (o -> {
@@ -43,9 +47,9 @@ public void exampleOnErrorReturn() {
4347 .onErrorReturn (e -> "Error: " + e .getMessage ())
4448 .subscribe (v -> System .out .println (v ));
4549
46- // Rx
47- // is
48- // Error: adjective unknown
50+ // Rx
51+ // is
52+ // Error: adjective unknown
4953 }
5054
5155 public void exampleOnErrorResumeNext () {
@@ -59,10 +63,10 @@ public void exampleOnErrorResumeNext() {
5963 .onErrorResumeNext (Observable .just (Integer .MAX_VALUE ))
6064 .subscribe (new PrintSubscriber ("with onError: " ));
6165
62- // with onError: 1
63- // with onError: 2
64- // with onError: 2147483647
65- // with onError: Completed
66+ // with onError: 1
67+ // with onError: 2
68+ // with onError: 2147483647
69+ // with onError: Completed
6670 }
6771
6872 public void exampleOnErrorResumeNextRethrow () {
@@ -75,6 +79,10 @@ public void exampleOnErrorResumeNextRethrow() {
7579 values
7680 .onErrorResumeNext (e -> Observable .error (new UnsupportedOperationException (e )))
7781 .subscribe (new PrintSubscriber ("with onError: " ));
82+
83+ // with onError: : 1
84+ // with onError: : 2
85+ // with onError: : Error: java.lang.UnsupportedOperationException: java.lang.Exception: Oops
7886 }
7987
8088 public void exampleOnExceptionResumeNext () {
@@ -87,6 +95,10 @@ public void exampleOnExceptionResumeNext() {
8795 values
8896 .onExceptionResumeNext (Observable .just ("hard" ))
8997 .subscribe (v -> System .out .println (v ));
98+
99+ // Rx
100+ // is
101+ // hard
90102 }
91103
92104 @ SuppressWarnings ("serial" )
@@ -100,6 +112,10 @@ public void exampleOnExceptionResumeNextNoException() {
100112 values
101113 .onExceptionResumeNext (Observable .just ("hard" ))
102114 .subscribe (v -> System .out .println (v ));
115+
116+ // Rx
117+ // is
118+ // uncaught exception
103119 }
104120
105121
0 commit comments