class ErrorUtil {

    public static String stackTraceString(Exception e) {
        StringWriter stackTrace = new StringWriter();
        try (PrintWriter pw = new PrintWriter(stackTrace)) {
            e.printStackTrace(pw);
            return stackTrace.toString();
        }
    }

}