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

BlockingObservable.single() should not return an Optional #1525

Closed
3 of 12 tasks
skerkewitz opened this issue Dec 12, 2017 · 2 comments
Closed
3 of 12 tasks

BlockingObservable.single() should not return an Optional #1525

skerkewitz opened this issue Dec 12, 2017 · 2 comments

Comments

@skerkewitz
Copy link

skerkewitz commented Dec 12, 2017

BlockingObservable.single() should not return an Optional:

I recently started to use BlockingObservable.single() in my unit tests and was wondering why it returns an Optional. If you look into the actual implementation it looks to me that it is not possible for the implementation to return an Optional. Because in that case the implementation would throw a RxError.

I had a quick chat on the RxSwift Slack channel and and a brief look my concern was confirmed.

Expected outcome:

I expect either to have a valid non optional result or an error was thrown.

What actually happens:

Currently my result has to be an optional and I either have to add a force unwrap or a guard statement in my test cases.

Self contained code example that reproduces the issue:

        let result = Observable.just(0.0).toBlocking(timeout: 10).single()

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

RxSwift 4.0.0

Platform/Environment

  • iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

Only use iOS but it should be the same for all platforms.

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • easy, 100% repro
  • sometimes, 10%-100%
  • hard, 2% - 10%
  • extremely hard, %0 - 2%

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • just starting
  • I have a small code base
  • I have a significant code base
@kzaher
Copy link
Member

kzaher commented Dec 12, 2017

Hi @skerkewitz ,

we've changed the implementation but the interface unfortunately remained the same.
It was an oversight.

@skerkewitz
Copy link
Author

Nice, thanks. 👍

@kzaher kzaher closed this as completed Dec 27, 2017
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

No branches or pull requests

2 participants