mirror of
https://github.com/better-auth/better-auth.git
synced 2026-08-01 10:50:40 -05:00
fix: handle inconsistent user update error in phone number plugin (#3925)
This commit is contained in:
@@ -688,9 +688,10 @@ export const phoneNumber = (options?: PhoneNumberOptions) => {
|
||||
ctx,
|
||||
);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return ctx.json(null);
|
||||
throw new APIError("INTERNAL_SERVER_ERROR", {
|
||||
message: BASE_ERROR_CODES.FAILED_TO_UPDATE_USER,
|
||||
});
|
||||
}
|
||||
|
||||
await options?.callbackOnVerification?.(
|
||||
@@ -701,12 +702,6 @@ export const phoneNumber = (options?: PhoneNumberOptions) => {
|
||||
ctx.request,
|
||||
);
|
||||
|
||||
if (!user) {
|
||||
throw new APIError("INTERNAL_SERVER_ERROR", {
|
||||
message: BASE_ERROR_CODES.FAILED_TO_UPDATE_USER,
|
||||
});
|
||||
}
|
||||
|
||||
if (!ctx.body.disableSession) {
|
||||
const session = await ctx.context.internalAdapter.createSession(
|
||||
user.id,
|
||||
|
||||
Reference in New Issue
Block a user