You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im using restclient builder to access jax-rs subresrources. However, when an error http response is received, instead of calling a registered ResponseExceptionMapper, a ExceptionMapping.HandlerException is thrown with the message 'Handled internally'. To get the correct runtime exception thrown, i have to surround my call in try/catch and call the mapping manually:
try {
returnsubResourceController.subresourceMethod(subresourceMethodParam);
} catch (ExceptionMapping.HandlerExceptione) {
// Mapping not performed on subresources :/try {
MethodsubresourceMethod = SubResourceController.class.getMethod("subresourceMethod", SubresourceMethodParam.class);
e.mapException(subresourceMethod);
} catch (RuntimeExceptione2) {
throwe2; // rethrows the mapped exception
} catch (Exceptione3) {
thrownewAssertionError("Should not reach this", e3); // error during mapping
}
thrownewAssertionError("Should not reach this", e); // exception not mapped
}
With this construct, my ResponseExceptionMapper is called as expected, and I can access the desired fields (response status, body, ...)
Im using resteasy-client 6.2.4.Final and microprofile-rest-client 2.1.4.Final.
org.jboss.resteasy.microprofile.client.ExceptionMapping$HandlerException: Handled Internally
at org.jboss.resteasy.microprofile.client.ExceptionMapping.filter(ExceptionMapping.java:113)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.filterResponse(ClientInvocation.java:667)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:428)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:134)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:103)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:61)
For a call on a normal resource (not a subresource), the HandlerException is created, from the same call stack; but later mapped and rethrown as a WebApplicationException:
at be.fiscalteam.nitro.it.client.util.ClientExceptionMapper.toThrowable(ClientExceptionMapper.java:17)
at be.fiscalteam.nitro.it.client.util.ClientExceptionMapper.toThrowable(ClientExceptionMapper.java:9)
at org.jboss.resteasy.microprofile.client.ExceptionMapping$HandlerException.mapException(ExceptionMapping.java:60)
at org.jboss.resteasy.microprofile.client.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:147)
This is the be.fiscalteam.nitro.it.client.util.ClientExceptionMapper. registered using RestClientBuilder.newBuilder().register(new ClientExceptionMapper()):
Im using restclient builder to access jax-rs subresrources. However, when an error http response is received, instead of calling a registered ResponseExceptionMapper, a ExceptionMapping.HandlerException is thrown with the message 'Handled internally'. To get the correct runtime exception thrown, i have to surround my call in try/catch and call the mapping manually:
With this construct, my ResponseExceptionMapper is called as expected, and I can access the desired fields (response status, body, ...)
Im using resteasy-client 6.2.4.Final and microprofile-rest-client 2.1.4.Final.
The exception is created there: https://github.com/resteasy/resteasy-microprofile/blob/main/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ExceptionMapping.java#L50
The stacktrace leading to it is:
For a call on a normal resource (not a subresource), the HandlerException is created, from the same call stack; but later mapped and rethrown as a WebApplicationException:
This is the
be.fiscalteam.nitro.it.client.util.ClientExceptionMapper.
registered usingRestClientBuilder.newBuilder().register(new ClientExceptionMapper())
:The subresources I use are defined as simple Jax-rs interfaces, like for the normal resources but lacking a @path annotation on the class.
Examples:
The text was updated successfully, but these errors were encountered: