Skip to content

Commit 3141278

Browse files
committed
Add error variant to RxScala
1 parent 54a4793 commit 3141278

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Observable.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,6 +3811,21 @@ object Observable {
38113811
toScalaObservable[T](rx.Observable.error(exception))
38123812
}
38133813

3814+
/**
3815+
* Returns an Observable that invokes an `Observer`'s `onError` method on the
3816+
* specified Scheduler.
3817+
*
3818+
* <img width="640" height="190" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/error.s.png">
3819+
*
3820+
* @param exception the particular Throwable to pass to `onError`
3821+
* @param scheduler the Scheduler on which to call `onError`
3822+
* @tparam T the type of the items (ostensibly) emitted by the Observable
3823+
* @return an Observable that invokes the `Observer`'s `onError` method, on the specified Scheduler
3824+
*/
3825+
def error[T](exception: Throwable, scheduler: Scheduler): Observable[T] = {
3826+
toScalaObservable[T](rx.Observable.error(exception, scheduler))
3827+
}
3828+
38143829
/**
38153830
* Returns an Observable that emits no data to the [[rx.lang.scala.Observer]] and
38163831
* immediately invokes its [[rx.lang.scala.Observer#onCompleted onCompleted]] method

0 commit comments

Comments
 (0)