modified exception handling

This commit is contained in:
Kallesh B S 2025-05-02 14:50:19 +05:30
parent 5368f4069d
commit d0877903dc
2 changed files with 4 additions and 4 deletions

View File

@ -50,18 +50,18 @@ export class AuthService {
await cursor.close();
} else {
return new BadRequestException({
throw new BadRequestException({
Error: 'Error executing request try after some time!',
});
}
if (rows[0]['ERRORMESG']) {
return { error: 'Invalid username or password!' };
throw new BadRequestException({ error: 'Invalid username or password!' });
}
return { msg: 'Logged in successfully' };
} catch (err) {
console.error('Error fetching users: ', err.message);
return { error: 'Invalid username or password' };
throw new BadRequestException({ error: 'Invalid username or password' });
}
finally {
if (connection) {

View File

@ -56,7 +56,7 @@ async function bootstrap() {
})
.filter(Boolean);
return new BadRequestException({
throw new BadRequestException({
message: 'Validation failed',
errors: newResult,
});