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 does not accept custom Error to throw #2257

Closed
crunchie84 opened this issue Jan 6, 2017 · 4 comments
Closed

Timeout operator does not accept custom Error to throw #2257

crunchie84 opened this issue Jan 6, 2017 · 4 comments

Comments

@crunchie84
Copy link
Contributor

The documentation of rxjs5 states that you can still call .timeout(100, new MyError(), scheduler) but this seems not to be the case.

RxJS version:
5.0.2 (npm)

Code to reproduce:

Rx.Observable.of('foo')
  .delay(1000)
  .timeout(200, new Error('nope'), scheduler)
  .subscribe(null, err => console.log('err: ' + err.message));

Expected behavior:
the console.log is executed using the custom error Error in this case

Actual behavior:
timeout hit TypeError: this.scheduler.schedule is not a function

Additional information:

@kwonoj
Copy link
Member

kwonoj commented Jan 6, 2017

Yes, it has been deprecated but document has not updated yet. (https://github.com/ReactiveX/rxjs/blob/master/CHANGELOG.md#features), due to interface is not clear enough brings confusions (https://github.com/ReactiveX/rxjs-core-notes/blob/master/2016-12/december-05.md).

@kwonoj kwonoj closed this as completed Jan 6, 2017
@crunchie84
Copy link
Contributor Author

@kwonoj ACK! Should this issue then not be kept open as a reminder to update the documentation?

@matthewwithanm
Copy link

For people who stumble on this later, you can use .timeoutWith(2000, Observable.throw(new Error('delay exceeded'))) 😊

@lock
Copy link

lock bot commented Jun 6, 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 6, 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

3 participants