public final class ExceptionUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static Throwable |
getActualThrowable(Throwable throwable)
获取确切的异常信息
1.
|
static String |
getErrorMessageWithNestedException(Throwable ex)
获取组合本异常信息与底层异常信息的异常描述, 适用于本异常为统一包装异常类,底层异常才是根本原因的情况。
|
static Throwable |
getRootCause(Throwable ex)
获取异常的Root Cause.
|
static String |
getStackTraceAsString(Throwable ex)
将ErrorStack转化为String.
|
static boolean |
isCausedBy(Exception ex,
Class<? extends Exception>... causeExceptionClasses)
判断异常是否由某些底层的异常引起.
|
static void |
throwUnsupportedOperationException()
抛出运行时不支持的操作异常
|
static RuntimeException |
unchecked(Throwable ex)
将CheckedException转换为UncheckedException.
|
static Throwable |
unwrapThrowable(Throwable wrapped)
解包异常
|
public static Throwable unwrapThrowable(Throwable wrapped)
wrapped - 异常public static void throwUnsupportedOperationException()
public static RuntimeException unchecked(Throwable ex)
ex - ex 异常public static String getStackTraceAsString(Throwable ex)
ex - 异常public static String getErrorMessageWithNestedException(Throwable ex)
ex - 异常public static Throwable getRootCause(Throwable ex)
ex - 异常public static boolean isCausedBy(Exception ex, Class<? extends Exception>... causeExceptionClasses)
ex - 异常causeExceptionClasses - 导致的异常原因true 是否由某个异常引起Copyright © 2024. All rights reserved.