Skip to content

Instantly share code, notes, and snippets.

@dnozay
Created June 30, 2016 20:04
Show Gist options
  • Save dnozay/6eb65557fb499c9625d9eee0ee2a55cb to your computer and use it in GitHub Desktop.
Save dnozay/6eb65557fb499c9625d9eee0ee2a55cb to your computer and use it in GitHub Desktop.
formatting an exception.
// http://stackoverflow.com/questions/1149703/how-can-i-convert-a-stack-trace-to-a-string
def formatStackTraceString(t: Throwable): String = {
s"""
| exception: ${t.getClass.getName}
| message: ${t.getMessage}
| cause: ${t.getCause}
| stacktrace:
| ${indent(t.getStackTraceString, spaces = 4)}
""".stripMargin
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment