mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-28 17:10:48 +08:00
Return 404 when user or post not found
This commit is contained in:
@@ -28,7 +28,7 @@ public class DraftService {
|
||||
@Transactional
|
||||
public Draft saveDraft(String username, Long categoryId, String title, String content, List<Long> tagIds) {
|
||||
User user = userRepository.findByUsername(username)
|
||||
.orElseThrow(() -> new IllegalArgumentException("User not found"));
|
||||
.orElseThrow(() -> new com.openisle.exception.NotFoundException("User not found"));
|
||||
Draft draft = draftRepository.findByAuthor(user).orElse(new Draft());
|
||||
draft.setAuthor(user);
|
||||
draft.setTitle(title);
|
||||
|
||||
Reference in New Issue
Block a user