Skip to content

Commit 18b1ea8

Browse files
authored
Add more detailed error message for SQS exceptions in QueueAttributesResolver (#1200)
1 parent c411070 commit 18b1ea8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/QueueAttributesResolver.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import software.amazon.awssdk.services.sqs.model.GetQueueUrlResponse;
3939
import software.amazon.awssdk.services.sqs.model.QueueAttributeName;
4040
import software.amazon.awssdk.services.sqs.model.QueueDoesNotExistException;
41+
import software.amazon.awssdk.services.sqs.model.SqsException;
4142

4243
/**
4344
* 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<QueueAttributes> resolveQueueAttributes() {
8586
}
8687

8788
private CompletableFuture<QueueAttributes> wrapException(Throwable t) {
88-
return CompletableFutures.failedFuture(new QueueAttributesResolvingException("Error resolving attributes for queue "
89-
+ this.queueName + " with strategy " + this.queueNotFoundStrategy + " and queueAttributesNames " + this.queueAttributeNames,
89+
String message = "Error resolving attributes for queue "
90+
+ this.queueName + " with strategy " + this.queueNotFoundStrategy + " and queueAttributesNames " + this.queueAttributeNames;
91+
92+
if (t.getCause() instanceof SqsException) {
93+
message += "\n This might be due to connectivity issues or incorrect configuration. " +
94+
"Please verify your AWS credentials, network settings, and queue configuration.";
95+
}
96+
97+
return CompletableFutures.failedFuture(new QueueAttributesResolvingException(message,
9098
t instanceof CompletionException ? t.getCause() : t));
9199
}
92100

0 commit comments

Comments
 (0)