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

Crash on asDriverOnErrorJustComplete function #22

Closed
ranhsd opened this issue Sep 27, 2017 · 5 comments
Closed

Crash on asDriverOnErrorJustComplete function #22

ranhsd opened this issue Sep 27, 2017 · 5 comments

Comments

@ranhsd
Copy link
Contributor

ranhsd commented Sep 27, 2017

Hi, I started to work on some side project which is based on this great project.

I facing some strange issue that when i execute a request from my view model to the server if the request failed the app crash. After debug it i found the crash is because the asserationFailure command check the error and because the error object is not nil the app crash.

This is the whole function:

func asDriverOnErrorJustComplete() -> Driver<E> { return asDriver { error in assertionFailure("Error \(error)") return Driver.empty() } }

My view model code is:

`
let login = input.loginTrigger.withLatestFrom(emailAndPassword)
.flatMapLatest({ [unowned self] (email, password) in

        return self.loginUseCase.login(username: email, password: password)
            .trackActivity(activityIndicator)
            .trackError(errorTracker)
            .asDriverOnErrorJustComplete()
    })

`

As you can see i use the same best practices like you use in your project.
I also tried to change your code so network requests will fail and the asDriverOnErrorJustComplete but from some reason on your project it ignore the asserationFailure line.
Can someone advice what should i do or what i am doing wrong?

thanks!

@sergdort
Copy link
Owner

Hi, @ranhsd

You doing everything correctly, this is my mistake :) there should not be assertionFailure as it perfectly fine for execution to reach that point. It should be something like this

@ranhsd
Copy link
Contributor Author

ranhsd commented Sep 30, 2017

Hi @sergdort ,
Thanks, would you like me to do the fix and create a pull request ?

@sergdort
Copy link
Owner

Sure, if you don’t mind :)

@ranhsd
Copy link
Contributor Author

ranhsd commented Oct 1, 2017

Hi @sergdort ,
i've created a pull request #25

Thanks,
Ran.

@sergdort
Copy link
Owner

sergdort commented Oct 1, 2017

Cool! I guess we can close this one :)

@sergdort sergdort closed this as completed Oct 1, 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