Frontend/Nest.js
NestJS : 예외처리
wam
2023. 1. 10. 14:28
getOne(id: number): Movie {
const movie = this.movies.find((movie) => movie.id === id);
if (!movie) {
throw new NotFoundException(`Movie with ID ${id} not found.`);
}
return movie;
}

- NotFoundException : NestJS가 제공하는 예외처리
- HttpException에서 확장된 NestJS의 제공 기능이다.