From daa297173a8e13c64435f82cafe2a6f29c709dc6 Mon Sep 17 00:00:00 2001 From: Jeong-In-Hee Date: Thu, 23 Nov 2023 17:53:41 +0900 Subject: [PATCH] fix: modify notification message according to exception --- .../gifthub/vouchers/service/VoucherSaveService.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java index 5659643..fa0e0ba 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java @@ -6,7 +6,6 @@ import org.springframework.stereotype.Service; import org.swmaestro.repl.gifthub.auth.service.UserService; -import org.swmaestro.repl.gifthub.exception.BusinessException; import org.swmaestro.repl.gifthub.exception.GptResponseException; import org.swmaestro.repl.gifthub.exception.GptTimeoutException; import org.swmaestro.repl.gifthub.notifications.NotificationType; @@ -68,12 +67,12 @@ public void execute(VoucherAutoSaveRequestDto voucherAutoSaveRequestDto, String // 처리 완료 pendingVoucherService.delete(pendingId); throwable.printStackTrace(); - if (throwable instanceof BusinessException) { - fcmNotificationService.sendNotification("기프티콘 등록 실패", "이미 등록된 기프티콘 입니다.", username); - notificationService.save(userService.read(username), null, NotificationType.REGISTERED, "이미 등록된 기프티콘 입니다."); - } else { + if (throwable instanceof GptResponseException || throwable instanceof GptTimeoutException) { fcmNotificationService.sendNotification("기프티콘 등록 실패", "자동 등록에 실패했습니다. 다시 시도해 주세요.", username); notificationService.save(userService.read(username), null, NotificationType.REGISTERED, "자동 등록에 실패했습니다. 다시 시도해 주세요."); + } else { + fcmNotificationService.sendNotification("기프티콘 등록 실패", "이미 등록된 기프티콘 입니다.", username); + notificationService.save(userService.read(username), null, NotificationType.REGISTERED, "이미 등록된 기프티콘 입니다."); } }); }