From ea5701000b0f2c43425fe358da98707ed71f0525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Tue, 15 Jan 2019 13:07:10 +0100 Subject: [PATCH] Improved code --- src/main/scala/bootstrap/liftweb/Boot.scala | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/main/scala/bootstrap/liftweb/Boot.scala b/src/main/scala/bootstrap/liftweb/Boot.scala index 65560bb9f..2228e0fb0 100644 --- a/src/main/scala/bootstrap/liftweb/Boot.scala +++ b/src/main/scala/bootstrap/liftweb/Boot.scala @@ -496,26 +496,15 @@ class Boot extends MdcLoggable { } } - private def showException(le: Throwable): String = { - val ret = "Message: " + le.toString + "\n\t" + - le.getStackTrace.map(_.toString).mkString("\n\t") + "\n" + private def showExceptionAtJson(error: Throwable): String = { + val formattedError = "Message: " + error.toString + error.getStackTrace.map(_.toString).mkString(" ") - val also = le.getCause match { + val formattedCause = error.getCause match { case null => "" - case sub: Throwable => "\nCaught and thrown by:\n" + showException(sub) + case cause: Throwable => "Caught and thrown by: " + showExceptionAtJson(cause) } - ret + also - } - private def showExceptionAtJson(le: Throwable): String = { - val ret = "Message: " + le.toString + le.getStackTrace.map(_.toString).mkString(" ") - - val also = le.getCause match { - case null => "" - case sub: Throwable => "Caught and thrown by: " + showExceptionAtJson(sub) - } - - ret + also + formattedError + formattedCause } private def sendExceptionEmail(exception: Throwable): Unit = {