com.mchange.conveniences.throwable.core.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of conveniences_3 Show documentation
Show all versions of conveniences_3 Show documentation
Conveniences, usually extension methods, that seem useful across projects.
The newest version!
package com.mchange.conveniences.throwable
import scala.util.control.NonFatal
def extractFullStackTrace(t:Throwable) : String =
val sw = new java.io.StringWriter()
t.printStackTrace(new java.io.PrintWriter(sw))
sw.toString()
extension (t : Throwable)
def fullStackTrace : String = extractFullStackTrace(t)
object NonFatals:
val PrintStackTrace : PartialFunction[Throwable,Unit] = {
case NonFatal(t : Throwable) => t.printStackTrace()
}