Skip to content

Commit

Permalink
fix: 만료된 디바이스 토큰 별도 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
kimyu0218 committed Dec 23, 2024
1 parent bd060a5 commit 786e27d
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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);
}
}
}
}

0 comments on commit 786e27d

Please sign in to comment.