diff --git a/tests/test-jex/src/main/java/org/example/web/TestController.java b/tests/test-jex/src/main/java/org/example/web/TestController.java index 76791b0e..a1d98fc6 100644 --- a/tests/test-jex/src/main/java/org/example/web/TestController.java +++ b/tests/test-jex/src/main/java/org/example/web/TestController.java @@ -3,18 +3,22 @@ import java.io.IOException; import java.util.Set; +import org.example.Person; + import io.avaje.http.api.BodyString; import io.avaje.http.api.Controller; import io.avaje.http.api.Default; +import io.avaje.http.api.ExceptionHandler; import io.avaje.http.api.Filter; import io.avaje.http.api.Get; -import io.avaje.http.api.InstrumentServerContext; import io.avaje.http.api.Options; import io.avaje.http.api.Path; import io.avaje.http.api.Post; +import io.avaje.http.api.Produces; import io.avaje.http.api.QueryParam; import io.avaje.jex.Context; import io.avaje.jex.FilterChain; +import io.helidon.webserver.http.ServerResponse; @Path("test/") @Controller @@ -50,4 +54,21 @@ void filter(FilterChain chain) throws IOException { System.err.println("do nothing lmao"); chain.proceed(); } + + @ExceptionHandler + String exception(IllegalArgumentException ex) { + return "Err: " + ex; + } + + @Produces(statusCode = 501) + @ExceptionHandler + HelloDto exceptionCtx(Exception ex, Context ctx) { + return null; + } + + @ExceptionHandler(IllegalStateException.class) + void exceptionVoid(Context ctx) { + ctx.status(503); + ctx.text("IllegalStateException"); + } }