jooby icon indicating copy to clipboard operation
jooby copied to clipboard

problem throwing StatusCodeException when there's an error handler

Open ajcamilo opened this issue 7 years ago • 0 comments

In jooby 2.0.2, when I have an error handler, all the exceptions that are not "caught" by that handler make the request stall.

Here is a small example:

public class App extends Jooby
{
    {
        error(IllegalAccessException.class, ((ctx, cause, statusCode) -> {
            ctx.setResponseCode(statusCode);
            ctx.send(cause.getMessage());
        }));
        get("/test", ctx ->
            something()
        );
    }

    public String something() {
        throw new StatusCodeException(StatusCode.UNAUTHORIZED, "test");
    }

    public static void main(String[] args) {
        runApp(args, App::new);
    }
}

If you make a request to /test, the connection stalles.

ajcamilo avatar Jul 25 '19 09:07 ajcamilo