Skip to content
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

Error handling and validation #287

Conversation

benjchristensen
Copy link
Member

Refactoring related to arg validation and error handling.

#198 Throw if no onError handler specified
#278 Subscribe argument validation

- I would like to remove the no-arg constructor but not ready to pull the trigger
…ctor

- also questioning why to allow extending this and would like to make it a private constructor
As brought up in ReactiveX#278 there were inconsistencies in how arguments were being validated on subscribe methods.

All arguments to subscribe are now validated correctly at the beginning of method invocation and IllegalArgumentException thrown if null arguments are injected.

According to Rx Guideline 6.5 a null argument is considered "a catastrophic error occurs that should bring down the whole program anyway" and thus we immediately throw. A null argument should be caught immediately in development and has nothing to do with subscribe invocation which is what guideline 6.5 is talking about (since a null Observer can't have onError called on it anyways).
ReactiveX#198

As per Rx Design Guidelines 5.2:

 "when calling the Subscribe method that only has an onNext argument, the OnError behavior will be
 to rethrow the exception on the thread that the message comes out from the observable sequence.
 The OnCompleted behavior in this case is to do nothing."

A new OnErrorNotImplementedException was created so it is explicit as to where the exception is coming from and why.
@cloudbees-pull-request-builder

RxJava-pull-requests #158 SUCCESS
This pull request looks good

benjchristensen added a commit that referenced this pull request Jun 4, 2013
@benjchristensen benjchristensen merged commit 2a32cab into ReactiveX:master Jun 4, 2013
rickbw pushed a commit to rickbw/RxJava that referenced this pull request Jan 9, 2014
…and-validation

Error handling and validation
jihoonson pushed a commit to jihoonson/RxJava that referenced this pull request Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants