vert-x3 / vertx-web

HTTP web applications for Vert.x
Apache License 2.0
1.11k stars 531 forks source link

Exeptionhandler not working correctly #2625

Open Freetoplay951 opened 3 months ago

Freetoplay951 commented 3 months ago
[02:52:02] Unhandled exception in router
[02:52:03] Unhandled exception in router
[02:52:03] Unhandled exception in router
[02:52:08] Unhandled exception in router

I use:

Vertx vertex = Vertx.vertx();
Router router = Router.router(vertex);

router.route().handler(SessionHandler.create(LocalSessionStore.create(vertex)));
router.routeWithRegex("/files/.*").handler(this::handleFileRequests);
router.route().handler(BodyHandler.create()).handler(this::handleRequests);
router.route().failureHandler(failureContext -> {
    failureContext.response().setStatusCode(404).end();
});

HttpServer innerServer = vertex
        .createHttpServer()
        .requestHandler(router)
        .exceptionHandler(error -> {
        })
        .listen(port, handler -> {
        });
Freetoplay951 commented 3 months ago

I added it here as I thought that vertx web handles routes

tsegismont commented 3 months ago

What do you mean with not working? Are you talking about the exceptionHandler set on the HTTP server? This handler is not related to Vert.x Web route handlers, it's related to lower-level, connection problems.

Freetoplay951 commented 3 months ago

Imean that the error is stilöl showing up in console

Freetoplay951 commented 3 months ago

.exceptionHandler(error -> { }) should prevent it

tsegismont commented 2 months ago

So I can confirm setting an exception handler on the HTTP server will have no effect. Can you provide some reproduction steps?