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

fix(auth): handle error properly in loadCurrentUser #9539

Merged
merged 2 commits into from
Jan 10, 2025
Merged

Conversation

AMoreaux
Copy link
Contributor

Updated the loadCurrentUser function to throw specific errors when an API error occurs. This improves clarity and error handling, replacing the generic "No current user result" exception.

Fix #9536

@AMoreaux AMoreaux requested a review from FelixMalfait January 10, 2025 14:50
@AMoreaux AMoreaux self-assigned this Jan 10, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Improved error handling in the authentication flow by adding specific API error messages in the loadCurrentUser function, replacing the generic "No current user result" error.

  • Modified error handling in packages/twenty-front/src/modules/auth/hooks/useAuth.ts to check for API errors before accessing currentUser data
  • Added error message propagation from API response for better debugging and user feedback
  • Updated error handling in verify flow to properly handle authentication failures

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Updated the loadCurrentUser function to throw specific errors when an API error occurs. This improves clarity and error handling, replacing the generic "No current user result" exception.
@FelixMalfait FelixMalfait merged commit 4ca03d0 into main Jan 10, 2025
21 of 23 checks passed
@FelixMalfait FelixMalfait deleted the fix/issue-9536 branch January 10, 2025 16:21
Copy link

Fails
🚫

node failed.

Log

�[31mError: �[39m SyntaxError: Unexpected token C in JSON at position 0
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:5555:27)�[39m
�[90m    at fullyReadBody (node:internal/deps/undici/undici:1665:9)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m
�[90m    at async specConsumeBody (node:internal/deps/undici/undici:5564:7)�[39m
danger-results://tmp/danger-results-1c1dd4e8.json

Generated by 🚫 dangerJS against 0a4bf08

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.

Error: No current user result
3 participants