Skip to content

Nested Exception's message should not include the messages from causal chain #25162

Closed
@maxxedev

Description

@maxxedev

Change NestedRuntimeException, NestedCheckedException, etc so that the exception's getMessage() does not include the nested exception information.

NestedRuntimeException was first introduced all the way back in spring 1.0 as compatibility for code still running in Java 1.3 or older version, which did not have exception chaining feature. To easily make the chained exception messages visible to the user on such old Java versions, getMessage() recursively included the messages.

We are long past Java 1.3. Nowadays, the nested message information is extremely, unnecessarily verbose and repetitive.
Look at an example exception from a toy application.
And then look at the same exception without nested messages.

In typical large applications, the problem is exacerbated because the exception messages/stacktraces can span many many console pages. In most cases, we must locate the root exception anyways to make sense of it all because both the root exception message and the root stacktrace are needed to accurately diagnose the problem. The nested messages only impede the diagnostics.

Please remove nested exception messages.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions