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

MP Rest Client - meaningless exceptions #22090

Closed
kucharzyk opened this issue Dec 9, 2021 · 1 comment · Fixed by #22103
Closed

MP Rest Client - meaningless exceptions #22090

kucharzyk opened this issue Dec 9, 2021 · 1 comment · Fixed by #22103
Labels
area/rest-client area/user-experience Will make us lose users kind/bug Something isn't working
Milestone

Comments

@kucharzyk
Copy link
Contributor

Describe the bug

I'm using MicroProfile Rest Client with Quarkus and I have an issue with rest client exceptions.

My use case is simple.

If I make mistake in rest client URL I'll get 404 and following stacktrace

2021-12-09 21:33:16,635 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: org.jboss.resteasy.reactive.ClientWebApplicationException: Unknown error, status code 404
        at org.jboss.resteasy.reactive.client.impl.RestClientRequestContext.unwrapException(RestClientRequestContext.java:145)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.handleException(AbstractResteasyReactiveContext.java:320)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:164)
        at org.jboss.resteasy.reactive.client.impl.RestClientRequestContext$1.lambda$execute$0(RestClientRequestContext.java:251)
        at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100)
        at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63)
        at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:38)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: javax.ws.rs.WebApplicationException: Unknown error, status code 404
        at io.quarkus.rest.client.reactive.runtime.DefaultMicroprofileRestClientExceptionMapper.toThrowable(DefaultMicroprofileRestClientExceptionMapper.java:17)
        at io.quarkus.rest.client.reactive.runtime.MicroProfileRestClientResponseFilter.filter(MicroProfileRestClientResponseFilter.java:36)
        at org.jboss.resteasy.reactive.client.handlers.ClientResponseFilterRestHandler.handle(ClientResponseFilterRestHandler.java:20)
        at org.jboss.resteasy.reactive.client.handlers.ClientResponseFilterRestHandler.handle(ClientResponseFilterRestHandler.java:9)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
        ... 11 more

This stacktrace is totally meaningless.

After reading this stacktrace I don't know:

  • Which of rest clients failed MyRestClient
  • What rest client method was called MyRestClient.apiCall() or https://my-api:8080/endpoint
  • Where it was called from MyResource.callAPI() -> MySerivice.apiCall() -> MyRestClient.apiCall()

With ExceptionMapper I can extract rest client endpoint details from ClientWebApplicationException. Unfortunately I can't find any details about the call side.

How can I extract full stacktrace of the call side like "MyResource.callAPI() -> MySerivice.apiCall() -> MyRestClient.apiCall()".
I've tried creating my own ResponseExceptionMapper but I can't find nothing about the call side there.

At the moment only try-catch at the call side can give me full details about rest client call side.

Expected behavior

Quarkus should provide tdetails about rest client exception in stacktace out of the box - it's rather basic use case

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@kucharzyk kucharzyk added the kind/bug Something isn't working label Dec 9, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 9, 2021

/cc @michalszynkiewicz

@geoand geoand added the area/user-experience Will make us lose users label Dec 10, 2021
geoand added a commit to geoand/quarkus that referenced this issue Dec 10, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
geoand added a commit to geoand/quarkus that referenced this issue Dec 10, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
geoand added a commit to geoand/quarkus that referenced this issue Dec 10, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
geoand added a commit to geoand/quarkus that referenced this issue Dec 10, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
geoand added a commit to geoand/quarkus that referenced this issue Dec 10, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
geoand added a commit to geoand/quarkus that referenced this issue Dec 10, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
@quarkus-bot quarkus-bot bot added this to the 2.7 - main milestone Dec 11, 2021
geoand added a commit that referenced this issue Dec 11, 2021
Provide context for Reactive Rest Client exceptions
@gsmet gsmet modified the milestones: 2.7 - main, 2.6.0.Final Dec 13, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 13, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
(cherry picked from commit 903eb34)
@gsmet gsmet modified the milestones: 2.6.0.Final, 2.5.3.Final Dec 14, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 14, 2021
We now add the exact method that caused the exception
in order to make it easier for users to identity where
the exception is coming from

Fixes: quarkusio#22090
(cherry picked from commit 903eb34)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client area/user-experience Will make us lose users kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants