Skip to content

Implemented the 'Throw' operator with scheduler #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 9, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,30 @@ public static <T> Observable<T> empty(Scheduler scheduler) {
* @param <T>
* the type of the items (ostensibly) emitted by the Observable
* @return an Observable that invokes the {@link Observer}'s {@link Observer#onError onError} method when the Observer subscribes to it
* @see <a href="http://msdn.microsoft.com/en-us/library/hh244299(v=vs.103).aspx">MSDN: Observable.Throw Method</a>
*/
public static <T> Observable<T> error(Throwable exception) {
return new ThrowObservable<T>(exception);
}

/**
* Returns an Observable that invokes an {@link Observer}'s {@link Observer#onError onError} method with the specified scheduler.
* <p>
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/error.png">
*
* @param exception
* the particular error to report
* @param scheduler
* the scheduler to call the {@link Observer#onError onError} method.
* @param <T>
* the type of the items (ostensibly) emitted by the Observable
* @return an Observable that invokes the {@link Observer}'s {@link Observer#onError onError} method with the specified scheduler.
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211711(v=vs.103).aspx">MSDN: Observable.Throw Method</a>
*/
public static <T> Observable<T> error(Throwable exception, Scheduler scheduler) {
return Observable.<T> error(exception).subscribeOn(scheduler);
}

/**
* Converts an {@link Iterable} sequence into an Observable.
* <p>
Expand Down