File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
apps/web/src/server/modules/auth Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,19 @@ export const emailVerifyOtp = async ({
119119 . deleteFrom ( 'VerificationToken' )
120120 . where ( 'identifier' , '=' , vfnIdentifier )
121121 . returningAll ( )
122- . executeTakeFirstOrThrow ( )
122+ . executeTakeFirstOrThrow (
123+ // NOTE: If we are unable to find the token,
124+ // this means that it has been deleted between
125+ // our initial query and the deletion here
126+ ( ) =>
127+ new TRPCError ( {
128+ code : 'BAD_REQUEST' ,
129+ message :
130+ 'Token is invalid or has expired. Please request a new OTP.' ,
131+ } ) ,
132+ )
123133 } catch ( error ) {
124- // see error code here: https://www.prisma.io/docs/reference/api- reference/error-reference#p2025
134+ // see error code here: https://www.prisma.io/docs/orm/ reference/error-reference#p2025
125135 if (
126136 error instanceof Prisma . PrismaClientKnownRequestError &&
127137 error . code === 'P2025'
You can’t perform that action at this time.
0 commit comments