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

Internal server error exception mapping inconsistent in dev and prod #30267

Closed
hugomiguelabreu opened this issue Jan 9, 2023 · 1 comment
Closed
Labels
kind/bug Something isn't working triage/duplicate This issue or pull request already exists

Comments

@hugomiguelabreu
Copy link

hugomiguelabreu commented Jan 9, 2023

Describe the bug

By defining a full override of the default handler (html) for Throwable class, trying to still leverage the already provided handlers for e.g.: javax.ws.rs.NotFoundException, I am having inconsistencies through dev and prod.

Expected behavior

Consistent behavior through environments. I.e.:

404 outputs 404 page in both dev and prod
500 outputs 500 page in both dev and prod.

Actual behavior

500 page is always shown in prod.

How to Reproduce?

Adding the following mapper to the codebase:

import io.quarkus.arc.Priority;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Priority(10_000)
@Provider
public class InternalServerErrorMapper implements ExceptionMapper<Throwable> {
    @Override
    public Response toResponse(final Throwable exception) {
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
}

With these sample endpoints:

    @GET
   @Path("throw500")
    @Produces(MediaType.APPLICATION_JSON)
    public LocalDateTime time() {
            return LocalDateTime.of(2022, Month.NOVEMBER, 31, 13, 10);
    }

    @GET
    @Path("throw404")
    @Produces(MediaType.APPLICATION_JSON)
    public Slot okSlot() {
        throw new NotFoundException();
    }

Will override the Internal Server Error page in dev but not the 404 on dev i.e.,

Accessing /throw404 will show the 404 page.
Accessing /throw500 will show a blank page but with a 500 in the network call as expected.

Generating the prod image:
Accessing /throw404 will show a blank page but with a 500 in the network call and this is not expected. We are expecting a 404.
Accessing /throw500 will show a blank page but with a 500 in the network call as expected.

Output of uname -a or ver

Irrelevant

Output of java -version

openjdk 19.0.1 2022-10-18

GraalVM version (if different from Java)

Irrelevant

Quarkus version or git rev

2.15.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Irrelevant

Additional information

N/A

@hugomiguelabreu hugomiguelabreu added the kind/bug Something isn't working label Jan 9, 2023
@geoand
Copy link
Contributor

geoand commented Jan 10, 2023

This is basically a duplicate of #7883 which we plan to tackle soon

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
@geoand geoand added the triage/duplicate This issue or pull request already exists label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants