public final class ExceptionUtil extends Object
| 限定符和类型 | 方法和说明 | 
|---|---|
| static String | getMessage(Throwable e)获得完整消息,包括异常名 | 
| static StackTraceElement[] | getStackElements()获取当前栈信息 | 
| static String | stacktraceToOneLineString(Throwable throwable)堆栈转为单行完整字符串 | 
| static String | stacktraceToOneLineString(Throwable throwable,
                         int limit)堆栈转为单行完整字符串 | 
| static String | stacktraceToString(Throwable throwable)堆栈转为完整字符串 | 
| static String | stacktraceToString(Throwable throwable,
                  int limit)堆栈转为完整字符串 | 
| static String | stacktraceToString(Throwable throwable,
                  int limit,
                  Map<Character,String> replaceCharToStrMap)堆栈转为完整字符串 | 
| static Throwable | unwrap(Throwable wrapped)剥离反射引发的InvocationTargetException、UndeclaredThrowableException中间异常,返回业务本身的异常 | 
| static <T extends Throwable> | wrap(Throwable throwable,
    Class<T> wrapThrowable)包装一个异常 | 
| static RuntimeException | wrapRuntime(Throwable throwable)使用运行时异常包装编译异常 | 
public static RuntimeException wrapRuntime(Throwable throwable)
throwable - 异常public static <T extends Throwable> T wrap(Throwable throwable, Class<T> wrapThrowable)
throwable - 异常wrapThrowable - 包装后的异常类public static Throwable unwrap(Throwable wrapped)
wrapped - 包装的异常public static StackTraceElement[] getStackElements()
public static String stacktraceToOneLineString(Throwable throwable)
throwable - 异常对象public static String stacktraceToOneLineString(Throwable throwable, int limit)
throwable - 异常对象limit - 限制最大长度public static String stacktraceToString(Throwable throwable)
throwable - 异常对象public static String stacktraceToString(Throwable throwable, int limit)
throwable - 异常对象limit - 限制最大长度Copyright © 2021. All rights reserved.