示例#1
0
 /**
  * https://github.com/ReactiveX/RxJava/issues/198
  *
  * <p>Rx Design Guidelines 5.2
  *
  * <p>"when calling the Subscribe method that only has an onNext argument, the OnError behavior
  * will be to rethrow the exception on the thread that the message comes out from the Observable.
  * The OnCompleted behavior in this case is to do nothing."
  */
 @Test
 @Ignore("Subscribers can't throw")
 public void testErrorThrownWithoutErrorHandlerSynchronous() {
   try {
     Observable.error(new RuntimeException("failure")).subscribe();
     fail("expected exception");
   } catch (Throwable e) {
     assertEquals("failure", e.getMessage());
   }
 }
示例#2
0
    @Override
    public void onError(Throwable t) {
      if (done) {
        RxJavaPlugins.onError(t);
        return;
      }
      done = true;
      try {
        onError.accept(t);
      } catch (Throwable e) {
        t.addSuppressed(e);
      }
      actual.onError(t);

      try {
        onAfterTerminate.run();
      } catch (Throwable e) {
        RxJavaPlugins.onError(e);
      }
    }