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

Handle request errors on useUser hook [SDK-3227] #639

Merged
merged 8 commits into from
Apr 19, 2022
Merged

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Apr 8, 2022

Description

This PR handles errors thrown in the user fetcher and exposes them through the error property of the useUser hook. This means that, for example, the user going offline will not cause the checkSession() function to clear the user property of the useUser hook, but instead, the developer will get a RequestError with a status value of 0 in the error property:

Screen.Recording.2022-04-06.at.20.16.08.mov

This also means that developers can throw their own errors in their custom fetchers, and get them via the useUser hook.

Testing

  • [ X] This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not main

@Widcket Widcket requested a review from a team as a code owner April 8, 2022 01:26
@vercel
Copy link

vercel bot commented Apr 8, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/auth0/nextjs-auth0/bTxk4sGzJM6PzoSAUwNnJRWAjf7v
✅ Preview: Canceled

[Deployment for b0b42e5 canceled]

@Widcket Widcket added review:medium Medium review CH: Fixed PR is fixing a bug labels Apr 8, 2022
@vercel
Copy link

vercel bot commented Apr 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
nextjs-auth0 ⬜️ Ignored (Inspect) Apr 19, 2022 at 0:38AM (UTC)

@Widcket Widcket merged commit e70112e into main Apr 19, 2022
@Widcket Widcket deleted the fix/network-errors branch April 19, 2022 17:22
@adamjmcgrath adamjmcgrath mentioned this pull request May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CH: Fixed PR is fixing a bug review:medium Medium review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants