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

Add error handling to avoid crash if getting error reponse from loading image #103

Merged
merged 2 commits into from Dec 31, 2019

Conversation

xingye
Copy link
Contributor

@xingye xingye commented Dec 27, 2019

If any of the image requests get an error response, it will crash since binding error. Catch error and return an empty observable or a placeholder image to avoid the crash.

@jdisho
Copy link
Owner

jdisho commented Dec 28, 2019

Thanks for the contribution!
How about we create a custom operator in the ObservableType extension like the following:

func orEmpty() -> Observable<Element> {
    return catchError { _ in
        return Observable.empty()
    }
}

and use this operator in all the similar case?

@xingye
Copy link
Contributor Author

xingye commented Dec 30, 2019

Thanks for your reply.
I have applied the error handling using ObservableType extension for all the image view bindings.
Could you please help to review it?

@jdisho jdisho merged commit 3bdbdd7 into jdisho:develop Dec 31, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants