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

Always get error TypeError: Failed to fetch #513

Closed
naivefun opened this issue Jun 14, 2023 · 2 comments
Closed

Always get error TypeError: Failed to fetch #513

naivefun opened this issue Jun 14, 2023 · 2 comments

Comments

@naivefun
Copy link

naivefun commented Jun 14, 2023

I'd expect the error could be several kinds of type, but the catched exception is always TypeError: Failed to fetch. Is there options wrong?

I need access error code like ERR_NETWORK ERR_TOO_MANY_REDIRECTS etc ....

test.js

import ky from "ky";

ky("https://www.githubbbbbb.com")
  .text()
  .catch((e) => {
    console.log(e.name, e.message);
  });

run node test.js and it prints out TypeError fetch failed

image

@sholladay
Copy link
Collaborator

Fetch often throws very vague errors, unfortunately.

Try in a different browser. I find that Firefox and Safari in particular is usually the most informative.

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
@sindresorhus
Copy link
Owner

We cannot do anything about the errors Fetch throws.

Share your opinions here: whatwg/fetch#526

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