Sequence contains no elements

635 views
Skip to first unread message

Todd Nine

unread,
Mar 11, 2014, 12:49:47 PM3/11/14
to rxj...@googlegroups.com
Hey guys,
  I've implemented my on OnSubscribe function that wraps a Astyanax iterator and emits Observables.  This works well, however, if the user issues a query that has no results, my subscription immediately emits .onCompleted().  When doing this, it throws an exception below.


java.lang.IllegalArgumentException: Sequence contains no elements
at rx.operators.OperationSingle$1$1.onCompleted(OperationSingle.java:64)
at rx.Observable$28.onCompleted(Observable.java:7002)


Here is the link to my source.


Given that there may be no matches in Cassandra, is it possible to avoid this issue?



 

Dave Ray

unread,
Mar 11, 2014, 1:24:07 PM3/11/14
to Todd Nine, rxj...@googlegroups.com
It looks like you have a "single" operator after your Observable which is throwing the exception. I'd expect a similar exception if your Observable emitted more than one result as well.

If you're using BlockingObservable.single() to collect results, maybe try putting a toList() before it.

Dave
Reply all
Reply to author
Forward
0 new messages