diff --git a/quill-core/src/main/scala/io/getquill/util/MacroContextExt.scala b/quill-core/src/main/scala/io/getquill/util/MacroContextExt.scala index 8d6d7846ad..01761cf356 100644 --- a/quill-core/src/main/scala/io/getquill/util/MacroContextExt.scala +++ b/quill-core/src/main/scala/io/getquill/util/MacroContextExt.scala @@ -2,7 +2,7 @@ package io.getquill.util import io.getquill.idiom.Idiom import io.getquill.util.IndentUtil._ -import io.getquill.util.Messages.{ debugEnabled, prettyPrint } +import io.getquill.util.Messages.{ debugEnabled, errorPrefix, prettyPrint } import io.getquill.quat.VerifyNoBranches import scala.reflect.macros.blackbox.{ Context => MacroContext } @@ -14,10 +14,10 @@ object MacroContextExt { implicit class RichContext(c: MacroContext) { def error(msg: String): Unit = - c.error(c.enclosingPosition, msg) + c.error(c.enclosingPosition, if (errorPrefix) s"[quill] $msg" else msg) def fail(msg: String): Nothing = - c.abort(c.enclosingPosition, msg) + c.abort(c.enclosingPosition, if (errorPrefix) s"[quill] $msg" else msg) def warn(msg: String): Unit = c.warning(c.enclosingPosition, msg) diff --git a/quill-engine/src/main/scala/io/getquill/util/Messages.scala b/quill-engine/src/main/scala/io/getquill/util/Messages.scala index ecc8edf19a..312a8a1ca1 100644 --- a/quill-engine/src/main/scala/io/getquill/util/Messages.scala +++ b/quill-engine/src/main/scala/io/getquill/util/Messages.scala @@ -34,6 +34,7 @@ object Messages { def disableReturning = cache("quill.query.disableReturning", variable("quill.query.disableReturning", "quill_query_disableReturning", "false").toBoolean) def logBinds = cache("quill.binds.log", variable("quill.binds.log", "quill_binds_log", "false").toBoolean) def queryTooLongForLogs = cache("quill.query.tooLong", variable("quill.query.tooLong", "quill_query_tooLong", "200").toInt) + def errorPrefix = cache("quill.error.prefix", variable("quill.error.prefix", "quill_error_prefix", "false").toBoolean) sealed trait LogToFile object LogToFile {