Skip to content

Commit

Permalink
refactor: 에러 응답 양식 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungGwan123 committed Nov 19, 2024
1 parent 8aa181e commit cd05e56
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/server/src/account/account.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Post,
Request,
Res,
UnauthorizedException,
UseGuards,
} from '@nestjs/common';
import { AuthGuard } from '../auth/auth.guard';
Expand Down Expand Up @@ -36,7 +37,13 @@ import {Response} from "express";
) {
try{
const response = await this.accountService.getMyAccountData(req.user);
return res.status(response.statusCode).json(response.message)
if (response instanceof UnauthorizedException) {
return res
.status(HttpStatus.UNAUTHORIZED)
.json({ message: response.message }); // UnauthorizedException 처리
}

return res.status(response.statusCode).json(response.message);
}catch(error){
return res.status(error.statusCode).json(error)
}
Expand Down

0 comments on commit cd05e56

Please sign in to comment.