[lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3]
Mandy Chung
mchung at openjdk.java.net
Thu Jun 9 18:17:29 UTC 2022
On Thu, 9 Jun 2022 18:14:17 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> It's a convenient method but it's not equivalent to calling IdentityException(null, cause), Throwable(cause) is equivalent to Throwable(cause.getMessage(), cause) which is important if later a logger is configured to only log the error message.
>
> Exceptions in the JDK do not always have all four standard constructors as in `Throwable`. There was a discussion to audit the constructor choices for JDK exceptions. Some new exceptions do add all 4 constructors (`IllegalCallerException` and `WrongThreadException`). Since this one has a constructor taking the `cause` for exception chaining, it's reasonable to add the variant setting the default message to `cause.getMessage()`.
Exceptions in the JDK do not always have all four standard constructors as in `Throwable`. There was a discussion to audit the constructor choices for JDK exceptions. Some new exceptions do add all 4 constructors (`IllegalCallerException` and `WrongThreadException`). Since this one has a constructor taking the `cause` for exception chaining, it's reasonable to add the variant setting the default message to `cause.getMessage()`.
-------------
PR: https://git.openjdk.org/valhalla/pull/696
More information about the valhalla-dev
mailing list