fix: handle inconsistent user update error in phone number plugin (#3925)

This commit is contained in:
KinfeMichael Tariku
2025-08-11 14:08:06 +03:00
committed by GitHub
parent a6752eb059
commit 17717d6b67
@@ -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,