fix: better-auth better error catch#892
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 1c80d43 | Apr 28 2026, 11:48 PM |
How to use the Graphite Merge QueueAdd the label Main to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @MaheshtheDev's task in 2m 57s —— View job PR Review: better-auth better error catch
Summary: The magic link error handling is correctly updated to use return-based error checking. However, the social sign-in flows (Google/GitHub) add |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 1c80d43 | Commit Preview URL | Apr 28 2026, 11:49 PM |
There was a problem hiding this comment.
Overview: This PR switches better-auth from throw-based to return-based error handling by removing throw: true from the auth client config.
Issues found:
The magic link flow is correctly updated to destructure { error } from the response and check it. However, the social sign-in flows (Google/GitHub) only add .catch() handlers which won't work as expected:
- With
throw: trueremoved, API errors are returned as{ error }in the response object, not thrown as exceptions - The
.catch()handlers only catch thrown errors (like network failures), not returned{ error }values - If
signIn.social()fails before redirecting (e.g., rate limiting, server validation), the error will be silently ignored — the user will see loading stop but no error message
Suggested fix for apps/web/app/(auth)/login/new/page.tsx lines 358-360 and 425-427:
// Instead of:
.catch((err: unknown) => {
setError(getErrorMessage(err))
})
// Consider:
.then(({ error }) => {
if (error) setError(getErrorMessage(error))
})This matches the pattern used for magic link handling and ensures API errors are properly displayed.
Score: 7/10
The magic link fix is correct. The social sign-in error handling needs adjustment to catch returned errors, not just thrown exceptions.
Merge activity
|
cfff3d8 to
1c80d43
Compare

No description provided.