public static String errorInfoToString(Throwable e) { //try-with-resource语法糖 处理机制 try(StringWriter sw = new StringWriter();PrintWriter pw = new PrintWriter(sw)){ e.printStackTrace(pw); pw.flush(); sw.flush(); return sw.toString(); }catch (Exception ignored){ throw new RuntimeException(ignored.getMessage(),ignored); } }
10-04
441
