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

Change console.log to console.error for network error #11510

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

nphmuller
Copy link
Contributor

@nphmuller nphmuller commented Jan 22, 2024

console.error also logs the stack trace and the error cause. This will provide a lot more information to what went wrong.

Before this change:
[Network error]: TypeError: fetch failed

After this change:

[Network error]:  TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11372:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: getaddrinfo ENOTFOUND xxx.example.com
      at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)
      at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    errno: -3008,
    code: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: 'xxx.example.com'
  }
}

As you can see, after this change it's very clear that the endpoint is not available.

@nphmuller nphmuller requested a review from a team as a code owner January 22, 2024 12:51
@apollo-cla
Copy link

@nphmuller: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

Copy link

netlify bot commented Jan 22, 2024

👷 Deploy request for apollo-client-docs accepted.

Name Link
🔨 Latest commit 25c12d4
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/65ae65e3d6ac7f000813a3a4

Copy link

changeset-bot bot commented Jan 22, 2024

⚠️ No Changeset found

Latest commit: 25c12d4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

console.error also logs the stack trace and the error cause. This will provide a lot more information to what went wrong.

Before this change:
`[Network error]: TypeError: fetch failed`

After this change:
```
[Network error]:  TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11372:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: getaddrinfo ENOTFOUND xxx.example.com
      at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)
      at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    errno: -3008,
    code: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: 'xxx.example.com'
  }
}
```

As you can see, after this change it's very clear that the endpoint is not available.
Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense to me! Thanks so much for the improvement!

@jerelmiller jerelmiller merged commit c1aaf6c into apollographql:main Jan 22, 2024
22 of 28 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants