snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

RESTEasy Reactive exception mapper issues #299

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 3 years ago

This one happens only in DEV mode. Start with this endpoint:

@Path("/")
public class GreetingResource {

    @Path("fruit/{id}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Uni<Object> fruit(@PathParam("id") Long id){
        throw new NotFoundException();
    }

//    @ServerExceptionMapper(NotFoundException.class)
//    public Response handleNotFound() {
//        System.err.println("We're in there");
//        return Response.status(Response.Status.NOT_FOUND)
//                .entity(new JsonObject()
//                        .put("type", "https://example.com/probs/cant-touch-this")
//                        .put("title", "we could not find it :("))
//                .type(MediaType.APPLICATION_JSON)
//                .build();
//    }
}

Now trigger the 404 with GET /fruit/123, you get the DEV Mode 404 red page.

Now uncomment the exception mapper and reload the page, you get:

Error handling 56fcd1fd-68f3-4922-926f-a263fa4ab22c-2, java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.acme1.GreetingResource$GeneratedExceptionHandlerFor$NotFoundException$OfMethod$handleNotFound

This looks very similar to #15748, but only for DEV mode. Perhaps it's different?

Now, a more annoying thing is that if I change the endpoint method to:

    @Path("fruit/{id}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Uni<Object> fruit(@PathParam("id") Long id){
        return Uni.createFrom().failure(() -> new NotFoundException());
    }

It behaves differently and doesn't even try to run my exception mapper, when it should be identical to the previous endpoint.


https://github.com/quarkusio/quarkus/issues/15763


$upstream:15763$