From 786e27d7fbc08b007e70780cbde8eba81e13d911 Mon Sep 17 00:00:00 2001 From: kimyu0218 Date: Mon, 23 Dec 2024 21:59:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A7=8C=EB=A3=8C=EB=90=9C=20=EB=94=94?= =?UTF-8?q?=EB=B0=94=EC=9D=B4=EC=8A=A4=20=ED=86=A0=ED=81=B0=20=EB=B3=84?= =?UTF-8?q?=EB=8F=84=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/firebase/PushMessageSenderImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/nexters/goalpanzi/application/firebase/PushMessageSenderImpl.java b/src/main/java/com/nexters/goalpanzi/application/firebase/PushMessageSenderImpl.java index 0361e3f..30be10b 100644 --- a/src/main/java/com/nexters/goalpanzi/application/firebase/PushMessageSenderImpl.java +++ b/src/main/java/com/nexters/goalpanzi/application/firebase/PushMessageSenderImpl.java @@ -1,16 +1,15 @@ package com.nexters.goalpanzi.application.firebase; -import com.google.firebase.messaging.FirebaseMessaging; -import com.google.firebase.messaging.FirebaseMessagingException; -import com.google.firebase.messaging.Message; -import com.google.firebase.messaging.Notification; +import com.google.firebase.messaging.*; import com.nexters.goalpanzi.exception.BaseException; import com.nexters.goalpanzi.exception.ErrorCode; import com.nexters.goalpanzi.infrastructure.firebase.PushMessageSender; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.Map; +@Slf4j @Component public class PushMessageSenderImpl implements PushMessageSender { @@ -85,7 +84,11 @@ private void sendMessage(final Message message, final ErrorCode errorCode) { try { FirebaseMessaging.getInstance().send(message); } catch (FirebaseMessagingException e) { - throw new BaseException(errorCode, e); + if (e.getMessagingErrorCode().equals(MessagingErrorCode.UNREGISTERED)) { + log.error(e.getMessage()); + } else { + throw new BaseException(errorCode, e); + } } } }