vertx.createHttpServer(new HttpServerOptions().setIdleTimeout(75)).requestHandler(router::accept).exceptionHandler(new Handler<Throwable>() {
@Override
public void handle(Throwable event) {
logger.error("Caught with exceptionhandler, exception: " + event.getMessage(), event);
}
}).listen(port, result -> {
if (result.succeeded()) {
logger.info("Verticle started at: " + port);
future.complete();
} else {
logger.error("Verticle failed", result.cause());
future.fail(result.cause());
}
});
According to the documentation, the ExceptionHandler is used for the handshake of a new connection (?) so might not be useful for my case.
On the WebClient side I simply do this:
HttpRequest<Buffer> req = webClient.get(service.port, service.host, "/" + requestURI);
req.timeout(requestParameters.readTimeout)
.as(BodyCodec.buffer())
.rxSend();
....
Not sure how I would get some exceptionHandler or similar attached there.
For completeness sake I added an ExceptionHandler to Vertx itself:
vertx.exceptionHandler(new Handler<Throwable>() {
@Override
public void handle(Throwable event) {
logger.error("Caught with exceptionhandler, exception: " + event.getMessage(), event);
}
});
Very vert helpful for any information since I have so many hours/days ob this!
Cheers,
Tim