eclipse-vertx / eclipse-vertx/vert.x

exceptionHandler of AsyncFile is not triggered

Open
#5,343 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
14.7k
Forks
2.1k
Avg merge
2d 7h
Merged PRs (30d)
28

Description

### 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?

```java
FileSystem files = Vertx.vertx().fileSystem();
Future 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
```java
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.