Skip to content

Commit

Permalink
sign in error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ojn03 committed Feb 16, 2024
1 parent a801a15 commit 90a5175
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/backend/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ParseIntPipe,
Post,
Request,
UnauthorizedException,
UseGuards,
UseInterceptors,
} from '@nestjs/common';
Expand Down Expand Up @@ -57,7 +58,9 @@ export class AuthController {

@Post('/signin')
signin(@Body() signInDto: SignInRequestDto): Promise<SignInResponseDto> {
return this.authService.signin(signInDto);
return this.authService.signin(signInDto).catch((err) => {
throw new UnauthorizedException(err.message);
});
}

// TODO implement change/forgotPassword endpoint (service methods are already implemented)
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class AuthService {
});
},
onFailure: (err) => {
console.log(err);
reject(err);
},
});
Expand Down

0 comments on commit 90a5175

Please sign in to comment.