diff --git a/src/modules/auth/auth.service.ts b/src/modules/auth/auth.service.ts index ab4b632..8bd6fa5 100644 --- a/src/modules/auth/auth.service.ts +++ b/src/modules/auth/auth.service.ts @@ -61,7 +61,10 @@ export class AuthService { : await this.authRepository.findByEmail(identifier) if (!account) { - throw new RpcException('Account not found') + throw new RpcException({ + code: 5, + details: 'Account not found' + }) } if (isPhoneType && !account.isPhoneVerified) { diff --git a/src/modules/otp/otp.service.ts b/src/modules/otp/otp.service.ts index 2ced3b9..119d4d2 100644 --- a/src/modules/otp/otp.service.ts +++ b/src/modules/otp/otp.service.ts @@ -31,12 +31,18 @@ export class OtpService { ) if (!stroredHash) { - throw new RpcException('Invalid or expired code') + throw new RpcException({ + code: 5, + details: 'Invalid or expired code' + }) } const hash = createHash('sha256').update(code).digest('hex') if (stroredHash !== hash) { - throw new RpcException('Invalid or expired code') + throw new RpcException({ + code: 5, + details: 'Invalid or expired code' + }) } await this.redisService.del(`otp:${type}:${indentifier}`)