Skip to content

exceptionHandler of AsyncFile is not triggered #5343

@d-william

Description

@d-william

Version

Vert.x core : 4.5.10

Context

The exceptionHandler of an AsyncFile is not triggered when an exception is thrown in the data handler (when read).

Do you have a reproducer?

FileSystem files = Vertx.vertx().fileSystem();
Future<AsyncFile> open = files.open("file.txt", new OpenOptions());
open.onSuccess(file -> {
    file.exceptionHandler(error -> {
        System.out.println("Error: " + error.getMessage());
    });
    file.handler(buffer -> {
        System.out.println("Read data: " + buffer.toString());
        throw new RuntimeException("Error");
    });
});

Here, "Error: Error" is not displayed

Some behavior if an exception is thrown in the end handler

file.endHandler(v -> {
    System.out.println("End of file");
    throw new RuntimeException("error");
});

Extra

  • Dev hint : Register an exception handler in the internal InboundBuffer of AsyncFileImpl

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions