agrestio / agrest

Server-side Java REST Framework for easy access to data graphs from various backends
https://agrest.io
Apache License 2.0
80 stars 34 forks source link

Ag. response eats exceptions thrown while calculating attributes #576

Open kbareja opened 2 years ago

kbareja commented 2 years ago

(v 4.10)

When I defined new attribute ( e.g. `AgEntity.overlay(Media.class).redefineAttribute("attr", String.class, this::calculate) and my attribute calculating function throws an exception (e.g. Null pointer) - there is no information about the problem anywhere in logs and server just returns unfinished list of data.

andrus commented 2 years ago

As the unit tests committed above show, the issue doesn't happen with small responses. It seems to happen when an encoder has a chance to flush some data to the client, and then the error happens. So the code has no chance to change the HTTP status or un-flush the partial content.

Still need to build a test for this case to see what we can do.