title: RxJava Break Chain on Conditional
body: <p>I am creating an observable sequence and I am basically looking for a nice way to break the chain if a condition is not met. Ideally we could through an error in this scenario. This is basically to remove an if/else statement in a flatmap operator. This is something like I have now</p>
  
  <pre><code>flatMap(new Func1&lt;User, Observable&lt;Response&gt;&gt;() {
                      @Override
                      public Observable&lt;Response&gt; call(Result result) {
                          if(isValid(result))) {
                              return api.getObservableResponse(); //some retrofit observable
                          } else {
                              observer.onError();
                              return null; //??? I guess this would force an error
                          }
                      }
                  })
  </code></pre>
  
  <p>I've seen operators such as filter() and all the other conditional ones but I am not sure if any of them meet my requirements. Is there a better way to do this? Or is what I have looking fine? Thanks!</p>