Open eschwartz opened 8 years ago
RxJS version: 4.1.0
Code to reproduce:
Rx.Observable .spawn(function*() { return 'A'; }) .map((val) => { console.log(`map: ${val}`) throw new Error('fail'); }) .retry(2) .subscribe( (val) => console.log(`onNext: ${val}`), (err) => console.log(`onError: ${err.message}`), (complete) => console.log('complete') );
Expected behavior:
map: A map: A onError: fail
Actual behavior:
map: A map: undefined onError: fail
Additional information:
Using Rx.Observable.spawn causes the second attempt to emit undefined instead of "A".
Rx.Observable.spawn
undefined
"A"
Note that this works as expected, if using Rx.Observable.fromPromise instead:
Rx.Observable.fromPromise
Rx.Observable .fromPromise(() => Promise.resolve('A')) .map((val) => { console.log(`map: ${val}`) throw new Error('fail'); }) .retry(2) .subscribe( (val) => console.log(`onNext: ${val}`), (err) => console.log(`onError: ${err.message}`), (complete) => console.log('complete') ); // map: A // map: A // onError: fail
I noticed when running this in CodePen, that it works as expected with TypeScript, but it fails when using plain JS.
This may explain why it's not caught by existing test coverage.
RxJS version: 4.1.0
Code to reproduce:
Expected behavior:
Actual behavior:
Additional information:
Using
Rx.Observable.spawn
causes the second attempt to emitundefined
instead of"A"
.Note that this works as expected, if using
Rx.Observable.fromPromise
instead: