add error handling for db calls

This commit is contained in:
andres
2023-06-16 12:01:14 +02:00
parent 121fceb97a
commit 9cd6595ae2
11 changed files with 590 additions and 114 deletions

View File

@@ -14,7 +14,7 @@ export class LocalStrategy extends PassportStrategy(Strategy) {
async validate(email: string, password: string): Promise<any> {
const newCredentials = await this.authService.checkCredentials(email, password)
if (newCredentials.resultCode === 1) {
throw new UnauthorizedException()
throw new UnauthorizedException('Invalid credentials')
}
return newCredentials
}