代码片段
banner 2022-03-02 23:31:30
# 将 Exception 转化为 String
/**
* 将 Exception 转化为 String
*/
public static String getExceptionToString(Throwable e) {
if (e == null) {
return "";
}
StringWriter stringWriter = new StringWriter();
e.printStackTrace(new PrintWriter(stringWriter));
return stringWriter.toString();
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11