Rest-Client-Reactive: Custom `WebApplicationExceptions` not accessable by MP-Fault-Tolerance
See original GitHub issueDescribe the bug
When using the retry mechanism of MP-Fault-Tolerance you usually do not want to retry on Status 400
, i.e. bad requests. To achieve that, I annotated a method with @Retry(abortOn = BadRequestException.class)
and converted 400
responses to a BadRequestException
in a custom ResponseExceptionMapper<WebApplicationException>
. That used to work with the old “Resteasy client”. Unfortunately, with Rest-Client-Reactive all WebApplicationExceptions
are wrapped by corresponding ClientWebApplicationExceptions
, so that the Retry
is not able to distinguish between response codes.
See https://github.com/quarkusio/quarkus/issues/22777 for another issue regarding exception wrapping.
Expected behavior
Custom WebApplicationException
types are passed through for interceptors like Retry
Actual behavior
All WebApplicationExceptions
are converted to ClientWebApplicationExceptions
How to Reproduce?
@RegisterRestClient
@RegisterProvider(RestView.BadRequestExceptionMapper.class)
public interface RestView {
@POST
@Path("/test")
@Retry(abortOn = BadRequestException.class)
String test(String param);
class BadRequestExceptionMapper implements ResponseExceptionMapper<WebApplicationException> {
@Override
public WebApplicationException toThrowable(Response response) {
return new BadRequestException();
}
@Override
public boolean handles(int status, MultivaluedMap<String, Object> headers) {
return status == HttpStatus.SC_BAD_REQUEST;
}
}
}
Output of uname -a
or ver
Microsoft Windows [Version 10.0.19042.1415]
Output of java -version
openjdk version “11.0.3” 2019-04-16 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.6.1.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
This is fixed in SmallRye Fault Tolerance 5.3.0, where in the non-compatible mode (which is on by default in Quarkus), exception cause chains are inspected.
There’s no release yet. There will be one soon, but it won’t make it into 2.7.