Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RESTEASY-2882] Changed the processing of ResponseExceptionMapper to … #2850

Conversation

rsearls
Copy link
Contributor

@rsearls rsearls commented Jun 21, 2021

…meet spec requirements

Copy link
Contributor

@jamezp jamezp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test doesn't look quite right to me. I made some comments on it, but it also needs some kind of resource to invoke too. Something like:

@Path("/")
public class HealthResource {

    @GET
    @Path("/health")
    @Produces(MediaType.APPLICATION_JSON)
    public Response status() {
        return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(new HealthCheckData("Down")).build();
    }
}

@jamezp
Copy link
Contributor

jamezp commented Jun 21, 2021

Actually maybe you meant the 404 to be thrown which is why there wasn't a resource. If that is the case we should probably change the name of the test and the exception mapper to Ingore404* instead.

@rsearls rsearls force-pushed the RESTEASY-2882-MicroProfile-NULL-ResponseExceptionMapper branch from 4064a05 to 7d51459 Compare June 24, 2021 16:24
@rsearls
Copy link
Contributor Author

rsearls commented Jun 24, 2021

Changes complete

@rsearls rsearls force-pushed the RESTEASY-2882-MicroProfile-NULL-ResponseExceptionMapper branch from 7d51459 to bb72f69 Compare June 24, 2021 20:53
@rsearls rsearls force-pushed the RESTEASY-2882-MicroProfile-NULL-ResponseExceptionMapper branch from bb72f69 to b910728 Compare June 24, 2021 22:06
@rsearls rsearls merged commit b119178 into resteasy:main Jun 24, 2021
// falling through to here means no applicable exception mapper found
// or applicable mapper returned null
LOGGER.warnf("No default ResponseExceptionMapper found or user's ResponseExceptionMapper returned null."
+ " Response status: %s messge: %s", handled.getStatus(), handled.getReasonPhrase());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in "%s message: %s"

@@ -151,6 +151,8 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
}
if (cause instanceof ExceptionMapping.HandlerException) {
((ExceptionMapping.HandlerException)cause).mapException(method);
// no applicable exception mapper found or applicable mapper returned null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't this be a debug log message too?

.getHealthData();
Assert.fail("Exception should have been returned");
} catch (Exception e) {
// success exception was returned

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert the expected exception class would be cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants