Vertx - Exception Handling
Table of Contents
About
exception handling in Vert.x - vertx command line
On Failure
authenticationProvider.authenticate(authInfo)
.onSuccess(user -> {
System.out.println("User " + user.principal() + " is now authenticated");
})
.onFailure(Throwable::printStackTrace);
Error handler
In case of Internal Server Error (ie status code 500), you can catch them with an errorHandler
router.errorHandler(500, rc -> {
System.err.println("Handling failure");
Throwable failure = rc.failure();
if (failure != null) {
failure.printStackTrace();
}
});
Documentation / Reference
- Handling exceptions - You can set an exceptionHandler