Class ExceptionUtil
java.lang.Object
com.sure.tool.util.ExceptionUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetMessage(Throwable throwable) 获取异常的简要信息(类型 + 消息)。static ThrowablegetRootCause(Throwable throwable) 定位最根本的异常(cause 链末端)。static StringgetStackTrace(Throwable throwable) 将异常堆栈转为多行字符串。static booleanisCausedBy(Throwable throwable, Class<? extends Throwable> type) 是否由指定类型异常导致(沿 cause 链查找)。static Throwable解包装异常:逐层剥离包装异常,返回最内层异常。static RuntimeException将受检异常包装为运行时异常(已是运行时异常则直接返回)。
-
Method Details
-
getStackTrace
-
getRootCause
-
getMessage
-
isCausedBy
-
wrap
将受检异常包装为运行时异常(已是运行时异常则直接返回)。- Parameters:
throwable- 异常- Returns:
- RuntimeException
-
unwrap
-