From f240affa322507172d795e333295f9dec63e9efe Mon Sep 17 00:00:00 2001 From: koomchang Date: Wed, 6 Nov 2024 13:51:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=A5=EC=86=8C=EB=A5=BC=20=EC=B0=BE?= =?UTF-8?q?=EC=9D=84=20=EC=88=98=20=EC=97=86=EC=9D=84=20=EB=95=8C=20id=20?= =?UTF-8?q?=EA=B0=92=EC=9D=84=20=EA=B0=99=EC=9D=B4=20=EC=A0=84=EB=8B=AC?= =?UTF-8?q?=ED=95=A0=20=EC=88=98=EB=8F=84=20=EC=9E=88=EA=B2=8C=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0=20#52?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/place/exception/PlaceNotFoundException.ts | 9 ++++++--- backend/src/place/place.service.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/place/exception/PlaceNotFoundException.ts b/backend/src/place/exception/PlaceNotFoundException.ts index eb2d4e40..167e4af8 100644 --- a/backend/src/place/exception/PlaceNotFoundException.ts +++ b/backend/src/place/exception/PlaceNotFoundException.ts @@ -2,11 +2,14 @@ import { BaseException } from '../../common/exception/BaseException'; import { HttpStatus } from '@nestjs/common'; export class PlaceNotFoundException extends BaseException { - constructor() { + constructor(id?: number) { + const message = id + ? `id:${id} 장소가 존재하지 않습니다.` + : '장소가 존재하지 않습니다.'; super({ code: 1002, - message: '해당 장소가 존재하지 않습니다.', - status: HttpStatus.NO_CONTENT, + message, + status: HttpStatus.NOT_FOUND, }); } } diff --git a/backend/src/place/place.service.ts b/backend/src/place/place.service.ts index 9dc330cb..ee40afc3 100644 --- a/backend/src/place/place.service.ts +++ b/backend/src/place/place.service.ts @@ -37,7 +37,7 @@ export class PlaceService { async getPlace(id: number) { const place = await this.placeRepository.findById(id); if (!place) { - throw new PlaceNotFoundException(); + throw new PlaceNotFoundException(id); } return place; }