-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Completable.subscribe(onError, onComplete) design issue #3851
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
Comments
The design pattern was: subscribe(Action0 onComplete)
subscribe(Action0 onComplete, Action1<Throwable> onError) |
@akarnokd what do you mean by
? |
I mean that is your suggestion but the current is swapped for case 2 because it is in the same order as the 3 arg |
Right, I pointed that in the issue description, but we do have As said before: no other overloads of |
Okay. Since Completable is experimental, lets swap the arguments as you suggested. |
Oh great, will do PR soon! |
This particular overload of
Completable.subscribe()
looks out of design in compare to other RxJava classes likeObservable
andSingle
.Spent ~5 minutes trying to understand why such code didn't compile:
And the reason is because this overload accepts
error
handler first andcomplete
handler second.I do understand that it comes from
Observable.subscribe(onNext, onError, onComplete)
.But in compare to many other overloads like:
Observable.subscribe(onNext, onError)
Single.subscribe(onSuccess, onError)
// this one has very similar semantic to target overload.Observable.subscribe(onNext)
Single.subscribe(onSuccess)
Error handler is never first parameter in
Observable.subscribe()
andSingle.subscribe()
.Another point is that compiler error displayed in IDE makes it even worse:

Completable
is still in@Experimental
, so, we can change this signature as we want. We can@Deprecate
this overload and add "better" alternative and then delete deprecated overload after one-two releases.The text was updated successfully, but these errors were encountered: