REQ-3282: 处理异常

This commit is contained in:
yanglin 2024-12-23 10:56:15 +08:00
parent fb72784b09
commit a735bc076d

View File

@ -8,6 +8,7 @@ import cn.axzo.msg.center.message.service.card.CardProps;
import cn.axzo.msg.center.message.service.card.CardRequestContext;
import com.google.common.base.Throwables;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
@ -17,6 +18,7 @@ import java.util.List;
/**
* @author yanglin
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CardLoggers {
@ -37,6 +39,14 @@ public class CardLoggers {
@Override
public void reloadAndLogCards(String operationContext, Exception exception) {
try {
reloadAndLogCardsImpl(operationContext, exception);
} catch (Exception e) {
log.warn("reloadAndLogCards failed. operationContext={}", operationContext, e);
}
}
private void reloadAndLogCardsImpl(String operationContext, Exception exception) {
if (!enableCardLog) return;
ArrayList<CardLog> logs = new ArrayList<>();
for (Card card : cardDao.reloadCards(cards)) {