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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom handleResponse Not Called on Fetch Failure #153

Open
blaskovicz opened this issue Nov 3, 2016 · 1 comment
Open

Custom handleResponse Not Called on Fetch Failure #153

blaskovicz opened this issue Nov 3, 2016 · 1 comment

Comments

@blaskovicz
Copy link

Firstly, thanks for the awesome library! I've been switching to React from Angular and it's starting to grow on me 馃槃

I'm trying to inject a custom error message to any fetch that fails without a more specific error message so I don't need to update all my components individually.

Looking at the code, it seems that handleResponse is called as a .then(), meaning if the fetch returns a failed Promise (eg: can't connect to foo.site.com), I have no way of injecting a custom json failure message.

Do you have any suggestions of a workaround? Perhaps handleReponse could also be called on failure?

Thoughts?

@blaskovicz
Copy link
Author

As a workaround, I had to override connect.defaults.fetch with some nasty logic.

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

1 participant