From f57aa94d7388b1d5f0c3abd49de8b98f6991f34f Mon Sep 17 00:00:00 2001 From: siyeonSon Date: Mon, 8 Apr 2024 16:27:10 +0900 Subject: [PATCH] :recycle: refactor(notification): use custom ErrorCode --- .../domains/notification/service/NotificationService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/streetdrop-batch/src/main/java/com/depromeet/domains/notification/service/NotificationService.java b/backend/streetdrop-batch/src/main/java/com/depromeet/domains/notification/service/NotificationService.java index 5e69b24c..a0aa0c51 100644 --- a/backend/streetdrop-batch/src/main/java/com/depromeet/domains/notification/service/NotificationService.java +++ b/backend/streetdrop-batch/src/main/java/com/depromeet/domains/notification/service/NotificationService.java @@ -1,5 +1,8 @@ package com.depromeet.domains.notification.service; +import static com.depromeet.common.error.code.TokenErrorCode.TOKEN_NOT_FOUND; + +import com.depromeet.common.error.exceptions.NotFoundException; import com.depromeet.domains.notification.dto.request.AllPushRequestDto; import com.depromeet.domains.notification.dto.request.PushRequestDto; import com.depromeet.domains.notification.dto.request.TopicPushRequestDto; @@ -28,7 +31,7 @@ public void save(PushRequestDto pushRequestDto) { for (Long userId : pushRequestDto.getUserIds()) { var userDevice = userDeviceRepository.findByUserId(userId) - .orElseThrow(() -> new RuntimeException("Token not found for userId: " + userId)); + .orElseThrow(() -> new NotFoundException(TOKEN_NOT_FOUND)); if (userDevice.isAlertOn()) { var notificationAction = NotificationAction.builder() .path(pushRequestDto.getPath())