From fb54f6e2987f16ce78189483cd5cf2c926cd042f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9line=20Pelletier?= <82821620+celinepelletier@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:03:31 -0400 Subject: [PATCH] fix: SKFP-1025 Add logs (#296) --- src/main/java/io/kidsfirst/core/service/AwsKmsService.java | 4 ++++ .../java/io/kidsfirst/web/rest/FenceAclGatewaySpecUtil.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/io/kidsfirst/core/service/AwsKmsService.java b/src/main/java/io/kidsfirst/core/service/AwsKmsService.java index fa3a603..f4f1732 100644 --- a/src/main/java/io/kidsfirst/core/service/AwsKmsService.java +++ b/src/main/java/io/kidsfirst/core/service/AwsKmsService.java @@ -2,6 +2,7 @@ import com.amazonaws.services.kms.AWSKMS; import com.amazonaws.services.kms.AWSKMSAsyncClient; +import com.amazonaws.services.kms.model.AWSKMSException; import com.amazonaws.services.kms.model.DecryptRequest; import com.amazonaws.services.kms.model.EncryptRequest; import lombok.extern.slf4j.Slf4j; @@ -45,6 +46,9 @@ public Mono encrypt(String original) { // Shouldn't be reachable, handle anyways log.error(e.getMessage(), e); return null; + } catch (AWSKMSException e) { + log.error("AWSKMSException occurs when encrypting [{}] with message {}", original, e.getMessage()); + return null; } }).subscribeOn(Schedulers.boundedElastic()); diff --git a/src/main/java/io/kidsfirst/web/rest/FenceAclGatewaySpecUtil.java b/src/main/java/io/kidsfirst/web/rest/FenceAclGatewaySpecUtil.java index da0ec8c..7694c1b 100644 --- a/src/main/java/io/kidsfirst/web/rest/FenceAclGatewaySpecUtil.java +++ b/src/main/java/io/kidsfirst/web/rest/FenceAclGatewaySpecUtil.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.kidsfirst.config.AllFences; import io.kidsfirst.core.model.Acl; +import lombok.extern.slf4j.Slf4j; import lombok.val; import org.springframework.cloud.gateway.route.builder.GatewayFilterSpec; import org.springframework.http.MediaType; @@ -13,6 +14,7 @@ import java.util.Collections; import java.util.Objects; +@Slf4j public class FenceAclGatewaySpecUtil { private final static ObjectMapper objectMapper = new ObjectMapper(); @@ -32,6 +34,8 @@ public static GatewayFilterSpec filterAcl(GatewayFilterSpec f, AllFences.Fence f } catch (JsonProcessingException e) { throw new IllegalStateException("Impossible to parse json", e); } + } else { + log.error("Error when retrieving ACLs for fence {} with status {}", fence.getName(), serverWebExchange.getResponse().getStatusCode()); } return Mono.just(Objects.requireNonNullElse(s, "")); }