public class ExceptionUtil extends Object
| 构造器和说明 |
|---|
ExceptionUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
containsType(Throwable throwable,
Class<?> clazz)
检查异常链中是否包含某种类型的异常。
|
static String |
getMessage(Throwable throwable)
获取异常的消息,如果消息为空,则返回异常的类名。
|
static Throwable |
getRootCause(Throwable throwable)
获取异常链中的根异常。
|
static String |
getStackTrace(Throwable throwable)
将异常堆栈跟踪转换为字符串。
|
static List<Throwable> |
getThrowableList(Throwable throwable)
获取异常链中所有的异常。
|
public static String getStackTrace(Throwable throwable)
throwable - 异常对象public static Throwable getRootCause(Throwable throwable)
throwable - 异常对象public static List<Throwable> getThrowableList(Throwable throwable)
throwable - 异常对象public static boolean containsType(Throwable throwable, Class<?> clazz)
throwable - 异常对象clazz - 要检查的异常类型Copyright © 2024. All rights reserved.