Skip to content

Commit 3a23a9b

Browse files
committed
Implemented the 'Throw' operator with scheduler
1 parent abc8bec commit 3a23a9b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,11 +578,30 @@ public static <T> Observable<T> empty(Scheduler scheduler) {
578578
* @param <T>
579579
* the type of the items (ostensibly) emitted by the Observable
580580
* @return an Observable that invokes the {@link Observer}'s {@link Observer#onError onError} method when the Observer subscribes to it
581+
* @see <a href="http://msdn.microsoft.com/en-us/library/hh244299(v=vs.103).aspx">MSDN: Observable.Throw Method</a>
581582
*/
582583
public static <T> Observable<T> error(Throwable exception) {
583584
return new ThrowObservable<T>(exception);
584585
}
585586

587+
/**
588+
* Returns an Observable that invokes an {@link Observer}'s {@link Observer#onError onError} method with the specified scheduler.
589+
* <p>
590+
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/error.png">
591+
*
592+
* @param exception
593+
* the particular error to report
594+
* @param scheduler
595+
* the scheduler to call the {@link Observer#onError onError} method.
596+
* @param <T>
597+
* the type of the items (ostensibly) emitted by the Observable
598+
* @return an Observable that invokes the {@link Observer}'s {@link Observer#onError onError} method with the specified scheduler.
599+
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211711(v=vs.103).aspx">MSDN: Observable.Throw Method</a>
600+
*/
601+
public static <T> Observable<T> error(Throwable exception, Scheduler scheduler) {
602+
return Observable.<T> error(exception).observeOn(scheduler);
603+
}
604+
586605
/**
587606
* Converts an {@link Iterable} sequence into an Observable.
588607
* <p>

0 commit comments

Comments
 (0)