Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra message for SQS exceptions in QueueAttributesResolver #1200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading