Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt): use more specific FetchError for useFetch errors #7435

Merged
merged 2 commits into from
Sep 12, 2022
Merged

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves nuxt/nuxt#14879

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

In the case of useFetch, errors will almost certainly be of the FetchError type so we can provide a bit more type hinting to the user to avoid the requirement of casting...

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added bug Something isn't working types 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Sep 12, 2022
@danielroe danielroe requested a review from pi0 September 12, 2022 09:10
@danielroe danielroe self-assigned this Sep 12, 2022
@netlify
Copy link

netlify bot commented Sep 12, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit 711a417
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/631ef7c3214dbb0009c16d25

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Looks good to me. However, currently, if interceptors fail for example we don't throw a network error. But is fixable for most cases.

@pi0 pi0 merged commit 563cf7c into main Sep 12, 2022
@pi0 pi0 deleted the fix/fetch-error branch September 12, 2022 09:23
This was referenced Sep 14, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useFetch() incorrectly typed error
2 participants