Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 38aa7fd

Browse files
committed
[Enhance] add user not found error handling
1 parent 896ab15 commit 38aa7fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/services/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default class AuthService {
7575
public async SignIn(email: string, password: string): Promise<{ user: IUser; token: string }> {
7676
const userRecord = await this.userModel.findOne({ email });
7777
if (!userRecord) {
78-
throw new Error('User not registered');
78+
throw createError(400, 'User not registered');
7979
}
8080
/**
8181
* We use verify from argon2 to prevent 'timing based' attacks

0 commit comments

Comments
 (0)