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

RxCommand.createFromStream() with a type Stream as provider does not emit an exception. #32

Closed
baku-apps opened this issue Dec 13, 2019 · 2 comments

Comments

@baku-apps
Copy link

baku-apps commented Dec 13, 2019

var streamController =
        StreamController<String>.broadcast();

    var command = RxCommand.createFromStream((_) {
      return streamController.stream.map((rideMap) {
        throw Exception();
      });
    });

    command.results.listen((r) {
      print(r.toString());
    });

    command.thrownExceptions.listen((e) {
      print(e.toString());
    });

    command.execute();

    streamController.add('test');

The following code does not emit to thrownException. If we change the stream for an Observable.just('test'), it will emit the error. I have a suspicion that the addStream() in the execute() does not work correctly. (line 646 in rx_command.dart: _commandResultsSubject.addStream(inputObservable).then((_) {)

When I replaced code of the RxCommandAsync execute() it did emit the error.

@baku-apps
Copy link
Author

Perhaps I'm creating the streamprovider incorrect? This is a simplified example.

In real life I'm returning a firestore stream and transform the data in the map(), which could cause an exception. Would appreciate some help.

Thanks, and merry xmass!

@escamoteur
Copy link
Collaborator

merry xmass to you too.

This wasn't reallya bug because it happened because you never closed the input controller. Still I now changed the implementation in V 4.3.4 so that it will always work. I added your example as new test

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