FIX: Invalid auth credentials return

This commit is contained in:
rodrigo.zamboni
2022-04-14 14:48:40 -03:00
parent 7e7deba2ab
commit 7d14080ac1
2 changed files with 10 additions and 3 deletions
+10 -2
View File
@@ -1,4 +1,10 @@
import { Body, Controller, Post } from '@nestjs/common';
import {
Body,
Controller,
HttpException,
HttpStatus,
Post,
} from '@nestjs/common';
import { AuthClientService } from 'src/clients/auth/client.service';
@@ -18,7 +24,9 @@ export class AuthController {
const tokens = await this.authClient
.signIn({ username, password })
.then((result) => result)
.catch((err) => console.log(err));
.catch((err) => {
throw new HttpException(err.message, HttpStatus.UNAUTHORIZED);
});
return tokens;
}