modified exception handling
This commit is contained in:
parent
5368f4069d
commit
d0877903dc
@ -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) {
|
||||
|
||||
@ -56,7 +56,7 @@ async function bootstrap() {
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
return new BadRequestException({
|
||||
throw new BadRequestException({
|
||||
message: 'Validation failed',
|
||||
errors: newResult,
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user