[crac] RFR: Improve C/R exception printout

Radim Vansa rvansa at openjdk.org
Wed Apr 17 06:33:09 UTC 2024


On Wed, 3 Jan 2024 15:18:22 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Some users might get confused by the inner exceptions reported during C/R as *suppressed* exceptions. This PR changes the printout to make it look as if the exception had multiple causes. For example the DryRunTest will report this:
>> 
>> jdk.crac.CheckpointException: Failed with 2 inner exceptions
>> Cause 1/2: java.lang.RuntimeException: should not pass
>> 	at DryRunTest$CRResource.beforeCheckpoint(DryRunTest.java:47)
>> 	at java.base/jdk.crac.impl.AbstractContext.invokeBeforeCheckpoint(AbstractContext.java:44)
>> 	... (redacted)
>> Cause 2/2: jdk.crac.impl.CheckpointOpenFileException: /tmp/jtreg-DryRunTest6956725915963168340.tmp
>> 	at java.base/jdk.internal.crac.JDKFileResource.lambda$beforeCheckpoint$1(JDKFileResource.java:89)
>> 	at java.base/jdk.crac.Core.checkpointRestore1(Core.java:174)
>>         ... (redacted)
>
> I also would prefer "nested" exceptions not to overlap with suppressed in implementation, to make sure the correct interface is always called. Indeed, a common parent class makes sense, and sometime in handling of the exception I had to write
> 
> catch (CheckpointException | RestoreException e) { ... }
> 
> 
> Which is probably correct way to indicate both checkpoint and restore failures are handled there. But if you want to just to print the "nested" exception, apprantly you'll need a common base exception. I.e. a common base looks good.

Still relevant, waiting for @AntonKozlov review.

-------------

PR Comment: https://git.openjdk.org/crac/pull/145#issuecomment-2060474927


More information about the crac-dev mailing list