Closed adamsmaka closed 7 years ago
Hey @adamsmaka
I can't reproduce this on the demo project. Did you do anything specific here with code you could share? Also, is this simulator or device ?
I don't think there's a problem with sending an error for a cancel event, there's no "Result" in this case. But i'm open to suggestions on changing if the community feels it shouldn't be this way.
Oh yes it was my mistake. I did something like this, and in Error case, it crashed the app.
newImageObs .subscribeOn(MainScheduler.instance) .bind(to: myImage) .addDisposableTo(self.bag)
I don't think that canceling action should emit error :) I would rather expect it when a camera is not available or something like that.
@adamsmaka bind
is not Error
-compatible. You have to take care that errors are handled before binding, for example by doing
newImageObs.subscribeOn(MainScheduler.instance)
.catchErrorJustReturns(nil)
.bind(to: goalImage)
.disposed(by: self.bag)
thank you, im still newbie with RxSwift 👍
@adamsmaka Two things
changing this (a few more members) to a next event we can do that
.completed
maybe, definitely not .next
, but that may be a bit inconvenient as now it'll be unclear (without additional actions) why it was completed :smile:
I'd say this is misusage and issue can be closed.
I prefer Error as an event since completed happens after selecting an asset and not exclusively for cancel so it's hard to target that specific event.
Moving to Single later on will make this more important in that case, since it will only have a single success event.
I think I'm gonna close this for the time being but if a good reason to change this will come up, we can rediscuss.
Thanks for the feedback @vhbit !
I'm not sure if is it good to send an Error event when use cancels during picking an image. Even more, my app crash when I press cancel, what is the reason?