Skip to content

Commit

Permalink
Prefix error messages with [quill] when switch is on (#2634)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliano authored Aug 18, 2023
1 parent 30ebd2f commit 7c49fe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ object Messages {
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 {
Expand Down

0 comments on commit 7c49fe2

Please sign in to comment.