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

timeout() operator always emits error, even if given a promise or another observable #1865

Closed
igorsechyn opened this issue Aug 3, 2016 · 4 comments

Comments

@igorsechyn
Copy link

RxJS version: 5.0.0-beta.10

Code to reproduce:

const rx = require('rxjs');
const source = rx.Observable
    .of(42)
    .delay(5000)
    .timeout(200, Promise.resolve(42));

const subscription = source.subscribe(
    function (x) { console.log('Next: %s', x); },
    function (err) { console.log('Error: %s', err); },
    function () { console.log('Completed'); });

Expected behavior:
Output: Next 42
Actual behavior:
Output: Error: [object Object]
Additional information:
According to documentation the timeout operator, if passed a promise or another observable, should emit this value. Currently, regardless of what is being passed into the operator, the value is being emitted as error

@kwonoj
Copy link
Member

kwonoj commented Aug 3, 2016

You may need timeoutWith to supply continuing observable when timeout occurs. due to polymorphic behavior of timeout, it has splitted into timeout and timeoutWith (refer #244 for background, #245 for implementation)

@igorsechyn
Copy link
Author

Awesome, thanks. Maybe worthwhile updating the documentation and/or the migration guideline

@kwonoj
Copy link
Member

kwonoj commented Aug 3, 2016

Yes, seems migration guide missing it, need to be updated.

@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants