jakartaee / jakartaee/rest

Spec text to do with mapping WebApplicationExceptions makes it impossible to get custom cause exceptions visible to mappers

Open
#323 20 comments 0 reactions 1 assignee Claimed by @glassfishrobot View on GitHub
Dominant language
Java
Stars
400
Forks
143
PR merge metrics
No merged PRs in 30d

Description

WAE and subclasses have constructors accepting Response and cause Throwable.

The spec text makes it impossible for the application code to throw WAE initialized with Response containing entity and the cause exception and make this cause exception visible to custom mappers expecting to react somehow to the cause exceptions.

Proposal:

1\. Keep the current optimization in place but update the spec to say that "if WAE Response entity is null or WAE cause exception is not null - use the mapper, otherwise - use WAE Response entity directly"

IMHO, much better solution is to drop this optimization - the typical mapper will never blindly replace WAE initialized Response - so keeping this optimization in place would really be about protecting the expectations of the providers which have not been written well.

If that still not an option - then 1 has to be done IMHO, the mappers must be able to see WAE cause exceptions if it is what the user wished by using the relevant constructors from the code

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.