spring-framework / org.springframework.core / NestedExceptionUtils

NestedExceptionUtils

abstract class NestedExceptionUtils

Helper class for implementing exception classes which are capable of holding nested exceptions. Necessary because we can't share a base class among different exception types.

Mainly for use within the framework.

Author
Juergen Hoeller

Since
2.0

See Also
NestedRuntimeExceptionNestedCheckedExceptionNestedIOExceptionorg.springframework.web.util.NestedServletException

Constructors

<init>

NestedExceptionUtils()

Helper class for implementing exception classes which are capable of holding nested exceptions. Necessary because we can't share a base class among different exception types.

Mainly for use within the framework.

Functions

buildMessage

open static fun buildMessage(message: String, cause: Throwable): String

Build a message for the given base message and root cause.

getMostSpecificCause

open static fun getMostSpecificCause(original: Throwable): Throwable

Retrieve the most specific cause of the given exception, that is, either the innermost cause (root cause) or the exception itself.

Differs from #getRootCause in that it falls back to the original exception if there is no root cause.

getRootCause

open static fun getRootCause(original: Throwable): Throwable

Retrieve the innermost cause of the given exception, if any.