Created
October 8, 2018 04:53
-
-
Save e2kaneko/be42f650e48938a9c8e775a7d3de111f to your computer and use it in GitHub Desktop.
例外トレースを文字列に変換
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 例外メッセージのトレース情報を文字列に変換します | |
* @param exception 例外オブジェクト | |
* @return 例外トレース文字列 | |
*/ | |
protected String getTraceString(Exception exception) { | |
StringWriter stringWriter = new StringWriter(); | |
PrintWriter printWriter = new PrintWriter(stringWriter); | |
exception.printStackTrace(printWriter); | |
printWriter.flush(); | |
return stringWriter.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment