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

Any way to extract the cause of a NetworkError when attempting to fetch a resource? #107

Open
BogdanEM opened this issue Sep 13, 2016 · 2 comments

Comments

@BogdanEM
Copy link

BogdanEM commented Sep 13, 2016

I have some code like:

isomorphicFetch(url, options)
    .then(
      (response) => {
        // ... check status, do something for ok, do something otherwise
      },
      (error) => {
       // ... some network issue with the call
      }
    );

I have an issue with the error handler, more exactly with the error parameter. It has no information whatsoever about what went wrong. All I can get from it is:

TypeError: NetworkError when attempting to fetch resource.

I have some code deployed in production who fails when calling a backend server with the above code and enters the error handler. The backend server actually responds correctly but then something happens to the response. The same applications deployed locally and in other environments have absolutely no issue, they work fine.

I cannot debug this because in lack of details of what went wrong. I can't even inspect network traffic since everything is over HTTPS. It's a complete dead end.

Is there a way to expose the cause of the error? Get some more details? Debug this somehow? Why isn't the error parameter exposing some cause?

@predragstojiljkovic
Copy link

I have the same problem. When error 401 occurs I get just:
TypeError: Failed to fetch(…) - in Chrome
TypeError: Network request failed - in IE11
etc.
And there is no way that I can figure out that an error was caused because user was not authenticated (session expired) so I can not redirect user to the login page when session expires.
Is there a way to figure out which error occurred (since it does not enter the (response) => {...} function)?

@dandv
Copy link

dandv commented Oct 2, 2016

Why isn't the error parameter exposing some cause?

Allegedly for security reasons or spec adherence.

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

3 participants