删除了service中delete throw exception的message

This commit is contained in:
高子兴 2024-07-03 14:52:48 +08:00
parent fdb9dc6daf
commit 173b507361

View File

@ -50,7 +50,7 @@ public class NewsService {
public void deleteNews(Long id) { public void deleteNews(Long id) {
if (!newsRepository.existsById(id)) { if (!newsRepository.existsById(id)) {
throw new EntityNotFoundException("News with id " + id + " not found."); throw new EntityNotFoundException();
} }
newsRepository.deleteById(id); newsRepository.deleteById(id);
} }