Skip to content

Commit

Permalink
Add more detailed error message for SQS exceptions in `QueueAttribute…
Browse files Browse the repository at this point in the history
…sResolver` (#1200)
  • Loading branch information
joseiedo authored Dec 11, 2024
1 parent c411070 commit 18b1ea8
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -85,8 +86,15 @@ public CompletableFuture<QueueAttributes> resolveQueueAttributes() {
}

private CompletableFuture<QueueAttributes> 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));
}

Expand Down

0 comments on commit 18b1ea8

Please sign in to comment.