heroku / heroku/react-refetch

Custom `handleResponse` Not Called on Fetch Failure

Open
#153 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
137
PR merge metrics
No merged PRs in 30d

Description

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

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](https://github.com/heroku/react-refetch/blob/master/src/components/connect.js#L292), 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.