Skip to content

Commit a0df172

Browse files
committed
fix: Improved error message
When a method defining `@AsyncGenericOperationBinding` has more than 1 argument and misses the `@Payload` annotation, the provided exception message was confusing. Instead of `Multi-parameter KafkaListener methods must have one parameter annotated with @payload but none was found` we now provide a more generic `Multi-parameter AsyncListener methods must have one parameter annotated with @payload but none was found`
1 parent 0bf21f4 commit a0df172

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

springwolf-core/src/main/java/io/github/stavshamir/springwolf/asyncapi/scanners/channels/annotation/SpringPayloadAnnotationTypeExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int getPayloadParameterIndex(
5454
int payloadAnnotatedParameterIndex = getPayloadAnnotatedParameterIndex(parameterAnnotations);
5555
if (payloadAnnotatedParameterIndex == -1) {
5656
String msg =
57-
"Multi-parameter KafkaListener methods must have one parameter annotated with @Payload, "
57+
"Multi-parameter AsyncListener methods must have one parameter annotated with @Payload, "
5858
+ "but none was found: "
5959
+ methodName;
6060

@@ -69,7 +69,7 @@ static int getPayloadAnnotatedParameterIndex(Annotation[][] parameterAnnotations
6969
for (int i = 0, length = parameterAnnotations.length; i < length; i++) {
7070
Annotation[] annotations = parameterAnnotations[i];
7171
boolean hasPayloadAnnotation =
72-
Arrays.stream(annotations).anyMatch(annotation -> annotation instanceof Payload);
72+
Arrays.stream(annotations).anyMatch(Payload.class::isInstance);
7373

7474
if (hasPayloadAnnotation) {
7575
return i;

0 commit comments

Comments
 (0)