Skip to content

Commit

Permalink
refactor(UnViewedCafeRefillListener):예외발생 전파 막기 위해 try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
hum02 committed Oct 10, 2023
1 parent 187fed4 commit 62f0691
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.project.yozmcafe.service;

import com.project.yozmcafe.domain.member.Member;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -10,6 +12,8 @@
@Component
public class UnViewedCafeRefillListener {

private static final Logger LOGGER = LoggerFactory.getLogger(UnViewedCafeRefillListener.class);

private final UnViewedCafeService unViewedCafeService;

public UnViewedCafeRefillListener(final UnViewedCafeService unViewedCafeService) {
Expand All @@ -20,6 +24,10 @@ public UnViewedCafeRefillListener(final UnViewedCafeService unViewedCafeService)
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void listen(final CafeRefillEvent event) {
final Member member = event.getMember();
unViewedCafeService.refillUnViewedCafes(member);
try {
unViewedCafeService.refillUnViewedCafes(member);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
}

0 comments on commit 62f0691

Please sign in to comment.