In my Quarkus microservice, I am using a microprofile rest client to fetch data from other external services:
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import io.smallrye.mutiny.Uni;
/**
* A MicroProfile REST client of internal services APIs, such as xxx service, xxx service. To
* configure the base URL, one needs to add a line to the application.properties file.
*/
@Path("/api")
@ApplicationScoped
@RegisterRestClient
public interface InternalService {
@GET
@Path...
}
One annoying thing is that in case of failures, it hides the response content, and always returns
{"message":"Handled
Internally","stackFrames":["org.jboss.resteasy.microprofile.client.ExceptionMapping$HandlerException:
Handled Internally","\tat
org.jboss.resteasy.microprofile.client.ExceptionMapping.filter(ExceptionMapping.java:72)","\tat
org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.filterResponse(ClientInvocation.java:715)","\tat
org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:489)","\tat
and by reading the source code, I found this default behavior is intentinoal:
/**
* This implementation is a bit of a hack and dependent on Resteasy internals.
* We throw a ResponseProcessingExceptoin that hides the Response object
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class ExceptionMapping implements ClientResponseFilter {
public static class HandlerException extends ResponseProcessingException {
protected ClientResponse handled;
protected List<ResponseExceptionMapper> candidates;
I think this client library is convenient and would like to continue to use it, but how can I tame it or override it in order to return the real error message?