8389
The root cause is the message for NestedException
included the cause (by concatenating by ; nested exception is ...
), which is NestedException
as well, so its message will include its own nested exception again, thus the horrible long exception messages. We don't need to include the cause message for stack trace will output its enclosed content at the Caused by:
section.
My approach is to only return the basic message excluding cause message in getMessage overridden method, via runtime stack trace inspection.
Testing case created to demonstrate that cause information is only output once in stack trace result.