From fda25f6a8634fbf6b1bb25068cd941c5708765a4 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 5 Aug 2021 10:50:25 +1000 Subject: [PATCH] Better error message --- .../reactive/common/processor/EndpointIndexer.java | 2 ++ .../reactive/server/processor/ServerEndpointIndexer.java | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java index cdf9781a3261e..28c5b5343a772 100644 --- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java +++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java @@ -944,6 +944,8 @@ && isContextType(paramType.asClassType())) { } else if (!field && pathParameters.contains(sourceName)) { builder.setName(sourceName); builder.setType(ParameterType.PATH); + builder.setErrorLocation(builder.getErrorLocation() + + " (this parameter name matches the @Path parameter name, so it has been implicitly assumed to be an @PathParam and not the request body)"); convertible = true; } else { //un-annotated field diff --git a/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java b/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java index 7416cb87142c3..04159da47737c 100644 --- a/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java +++ b/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java @@ -269,8 +269,13 @@ elementType, toClassName(paramType, currentClassInfo, actualEndpointInfo, index) protected void handleOtherParam(Map existingConverters, String errorLocation, boolean hasRuntimeConverters, ServerIndexedParameter builder, String elementType) { - builder.setConverter(extractConverter(elementType, index, - existingConverters, errorLocation, hasRuntimeConverters)); + try { + builder.setConverter(extractConverter(elementType, index, + existingConverters, errorLocation, hasRuntimeConverters)); + } catch (Throwable throwable) { + throw new RuntimeException("Could not create converter for " + elementType + " for " + builder.getErrorLocation() + + " of type " + builder.getType()); + } } protected void handleSortedSetParam(Map existingConverters, String errorLocation,