From ecdc7b4eb6ad2bb72bf46c6f958a359f2b1c5db2 Mon Sep 17 00:00:00 2001 From: "rodrigo.zamboni" Date: Thu, 14 Apr 2022 14:56:18 -0300 Subject: [PATCH] FIX: using Unauth nest function --- src/modules/auth/auth.controller.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index f5cd851..ba13f88 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -1,10 +1,4 @@ -import { - Body, - Controller, - HttpException, - HttpStatus, - Post, -} from '@nestjs/common'; +import { Body, Controller, Post, UnauthorizedException } from '@nestjs/common'; import { AuthClientService } from 'src/clients/auth/client.service'; @@ -25,7 +19,7 @@ export class AuthController { .signIn({ username, password }) .then((result) => result) .catch((err) => { - throw new HttpException(err.message, HttpStatus.UNAUTHORIZED); + throw new UnauthorizedException(err.message); }); return tokens;