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

Improve error typings #78

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Improve error typings #78

wants to merge 15 commits into from

Conversation

MattCCC
Copy link
Owner

@MattCCC MattCCC commented Oct 17, 2024

Improvements:

  • Typings: error object in responses properly infers query params, path params and request bodyr
  • Typings: Properly infer Request Body in the returned config
  • Typings: Added Query Params and Path Params typings to error interceptor
  • Append additional information to Network, CORS or any other fetch() errors

Fixes:

  • Typings: Properly infer Request Body in the config returned in response object
  • Returned error object should contain response, request and config objects
  • Fallback to response status for Network or CORS errors

Docs:

  • Add more examples to every strategy in the Error Handling section
  • Add example of Different Error and Success Responses in the Error Handling section

Potentially breaking changes:

  • Replaced ResponseErr with ResponseError name of returned error instances (make sure that you update its name wherever its utilized in your codebase)

Copy link

github-actions bot commented Oct 17, 2024

size-limit report 📦

Path Size
dist/browser/index.mjs 3.29 KB (-0.36% 🔽)
dist/browser/index.global.js 3.47 KB (+0.12% 🔺)
dist/node/index.js 3.42 KB (+0.23% 🔺)

Copy link
Collaborator

@red-game-dev red-game-dev left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

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

Successfully merging this pull request may close these issues.

3 participants