Skip to content

Commit 9128bd6

Browse files
authored
Merge pull request #415 from boostcampwm-2024/fix/feed-detail
🐛 fix: bad request exception -> not found exception 변경
2 parents 6ad28e6 + 9482e36 commit 9128bd6

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

server/src/feed/api-docs/readFeedDetail.api-docs.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { applyDecorators } from '@nestjs/common';
22
import {
33
ApiBadRequestResponse,
4+
ApiNotFoundResponse,
45
ApiOkResponse,
56
ApiOperation,
67
ApiQuery,
@@ -66,5 +67,11 @@ export function ApiReadFeedDetail() {
6667
message: '오류 메세지',
6768
},
6869
}),
70+
ApiNotFoundResponse({
71+
description: 'Not Found',
72+
example: {
73+
message: '0번 피드는 존재하지 않습니다.',
74+
},
75+
}),
6976
);
7077
}

server/src/feed/service/feed.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export class FeedService {
251251
feedId: feedDetailRequestDto.feedId,
252252
});
253253
if (!feed) {
254-
throw new BadRequestException(
254+
throw new NotFoundException(
255255
`${feedDetailRequestDto.feedId}번 피드는 존재하지 않습니다.`,
256256
);
257257
}

server/test/feed/e2e/feed-detail.e2e-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('GET api/feed/detail E2E Test', () => {
5959
expect(response.body.data.tag).toStrictEqual([]);
6060
});
6161

62-
it('없는 피드를 조회한다면 400번 에러를 반환한다.', async () => {
62+
it('없는 피드를 조회한다면 404번 에러를 반환한다.', async () => {
6363
//given
6464
const feedDetailRequestDto = new FeedDetailRequestDto({
6565
feedId: 100,
@@ -71,6 +71,6 @@ describe('GET api/feed/detail E2E Test', () => {
7171
);
7272

7373
//then
74-
expect(response.status).toBe(400);
74+
expect(response.status).toBe(404);
7575
});
7676
});

0 commit comments

Comments
 (0)