Skip to content

Commit

Permalink
NABI-112-refactor : exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
born-A committed Nov 4, 2023
1 parent dce1847 commit 8fa7721
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@ public CardCreateResponseDTO save(
try {
thumbnailUrl = cardImageService.uploadImageUrl(card.getCardId(), thumbnail);
} catch (IOException e) {
throw new RuntimeException(e);
throw new RuntimeException("썸네일 이미지 업로드를 실패하였습니다.");
}
savedCard.setThumbNailImage(thumbnailUrl);

List<CardImage> savedCardImages = cardImageService.uploadImageUrlList(card.getCardId(),files); // TODO: bulk insert 로 전환
List<CardImage> savedCardImages = null; // TODO: bulk insert 로 전환
try {
savedCardImages = cardImageService.uploadImageUrlList(card.getCardId(),files);
} catch (IOException e) {
throw new RuntimeException("카드 상세 이미지 업로드를 실패하였습니다.");
}

savedCardImages.add(0, CardImage.builder()
.imageUrl(thumbnailUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,13 @@ public String uploadImageUrl(Long cardId, MultipartFile file) throws IOException
}

@Transactional
public List<CardImage> uploadImageUrlList(Long cardId, List<MultipartFile> files) {
public List<CardImage> uploadImageUrlList(Long cardId, List<MultipartFile> files) throws IOException {
Card card = cardRepository.findById(cardId)
.orElseThrow(() -> new RuntimeException("해당 카드가 존재하지 않습니다"));

List<String> uploadFileList = null;

try {
uploadFileList = s3FileUploadService.uploadFileList(files);
} catch (IOException e) {
throw new RuntimeException(e);
}
uploadFileList = s3FileUploadService.uploadFileList(files);

List<CardImage> cardImageList = new ArrayList<>();

Expand Down

0 comments on commit 8fa7721

Please sign in to comment.