rsocket / rsocket-js

JavaScript implementation of RSocket
https://github.com/rsocket/rsocket-js
Apache License 2.0
604 stars 97 forks source link

Fix error messages in `onError` and in `onNext` #205

Open ScavengerSpb opened 2 years ago

ScavengerSpb commented 2 years ago

State error messages Flowable: Invalid call to onXxx(): onComplete/onError was already called.' / Flowable: Invalid call to onXxx(): onSubscribe has not been called.' are printed correctly now in onError and onNext methods.

Motivation:

Previously, state error message Flowable: Invalid call to onXxx(): onSubscribe has not been called.' was printed always regardles of the actual state of FlowableSubscriber. Even on attempt to operate on FlowableSubscriber when flow was completed already (either by prior call to onError or onComplete method).

Note: State error message in onComplete method works correctly already.

Modifications:

Checks for this._active are replaced with this._started.

Result:

State error message Flowable: Invalid call to onXxx(): onComplete/onError was already called.' is printed on attempt to operate on FlowableSubscriber when flow is completed already.