1 package kd.moya.zhgs.helper; 2 import java.io.PrintWriter; 3 import java.io.StringWriter; 4 /** 5 @ClassName: ErroHelper 6 @Description:TODO(异常解析) 7 @author: liul 8 @Date:2021/11/10 0010/15:08/星期三 9 / 10 public class ErroHelper { 11 /* 12 获取异常详细信息,知道出了什么错,错在哪个类的第几行 . 13 @param 14 @return 15 */ 16 public static String getThrowableDetail(Throwable ex) { 17 StringWriter sw = new StringWriter(); 18 try { 19 PrintWriter pw = new PrintWriter(sw, true); 20 ex.printStackTrace(pw); 21 pw.flush(); 22 sw.flush(); 23 } 24 catch (Exception e) { 25 } 26 return sw.toString(); 27 } 28 }
标签:PrintWriter,pw,sw,StringWriter,try,堆栈,catch From: https://www.cnblogs.com/liulsky/p/17447683.html