From 576bbb182915c2da36474caf93fb33fb86ee142b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20I=C3=AAdo?= Date: Sun, 1 Sep 2024 21:26:09 -0300 Subject: [PATCH] Add extra message for SQS exceptions in QueueAttributesResolver --- .../awspring/cloud/sqs/QueueAttributesResolver.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/QueueAttributesResolver.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/QueueAttributesResolver.java index aca55e50b..d5b99fd7c 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/QueueAttributesResolver.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/QueueAttributesResolver.java @@ -38,6 +38,7 @@ import software.amazon.awssdk.services.sqs.model.GetQueueUrlResponse; import software.amazon.awssdk.services.sqs.model.QueueAttributeName; import software.amazon.awssdk.services.sqs.model.QueueDoesNotExistException; +import software.amazon.awssdk.services.sqs.model.SqsException; /** * Resolves {@link QueueAttributes} for the specified queue. Fetchs the queue url for a queue name, unless a url is @@ -85,8 +86,15 @@ public CompletableFuture resolveQueueAttributes() { } private CompletableFuture wrapException(Throwable t) { - return CompletableFutures.failedFuture(new QueueAttributesResolvingException("Error resolving attributes for queue " - + this.queueName + " with strategy " + this.queueNotFoundStrategy + " and queueAttributesNames " + this.queueAttributeNames, + String message = "Error resolving attributes for queue " + + this.queueName + " with strategy " + this.queueNotFoundStrategy + " and queueAttributesNames " + this.queueAttributeNames; + + if (t.getCause() instanceof SqsException) { + message += "\n This might be due to connectivity issues or incorrect configuration. " + + "Please verify your AWS credentials, network settings, and queue configuration."; + } + + return CompletableFutures.failedFuture(new QueueAttributesResolvingException(message, t instanceof CompletionException ? t.getCause() : t)); }