How can status code passed to RoutingContext.fail(int) be retrieved in failure handler (registered using Route.failureHandler)?
E.g. If processing of some route takes too long, it can be interrupted by TimeoutHandler that calls fail(408) on RoutingContext. fail method subsequently invokes failure handler (if registered). However I can't find any way (except for reflection & depending on implementation) how to find out in handler itself why it was called:
RoutingContext.failure() returns nullRoutingContextImpl, not yet in HttpServerResponseNot sure about older version of Vert.x, but from 3.0.0 an up:
eventBus.send("some.address", "some value", event -> {
if (event.succeeded()) {
System.out.println("Received reply: " + event.result().body());
} else {
ReplyException cause = (ReplyException) event.cause();
String failMessage = cause.getMessage();
int failCode = cause.failureCode();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With