Skip to content

Commit

Permalink
refactor(all): replace chalkConfig in nil comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
ee7 committed Jun 17, 2024
1 parent 7aa99b9 commit db0537e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/chalk_common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ var
dockerInvocation*: DockerInvocation

template dumpExOnDebug*() =
if chalkConfig != nil and get[bool](getChalkScope(), "chalk_debug"):
if getChalkScope() != nil and get[bool](getChalkScope(), "chalk_debug"):
let
msg = "" # "Handling exception (msg = " & getCurrentExceptionMsg() & ")\n"
tb = "Traceback (most recent call last)\n" &
Expand Down
2 changes: 1 addition & 1 deletion src/confload.nim
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ proc loadLocalStructs*(state: ConfigState) =
setCon4mVerbosity(c4errLevel)

proc handleCon4mErrors(err, tb: string): bool =
if tb != "" and chalkConfig == nil or get[bool](getChalkScope(), "chalk_debug"):
if tb != "" and getChalkScope() == nil or get[bool](getChalkScope(), "chalk_debug"):
echo(formatCompilerError(err, nil, tb, default(InstInfo)))
else:
error(err)
Expand Down
2 changes: 1 addition & 1 deletion src/selfextract.nim
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ proc getSelfExtraction*(): Option[ChalkObj] =
# The rest of this is specific to writing the self-config.

proc newConfFileError(err, tb: string): bool =
if chalkConfig != nil and get[bool](getChalkScope(), "chalk_debug"):
if getChalkScope() != nil and get[bool](getChalkScope(), "chalk_debug"):
cantLoad(err & "\n" & tb)
else:
cantLoad(err)
Expand Down
4 changes: 2 additions & 2 deletions src/sinks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ proc chalkErrFilter*(msg: string, info: StringTable): (string, bool) =
if not getSuspendLogging() and keyLogLevel in info:
let llStr = info[keyLogLevel]

if (llStr in toLogLevelMap) and chalkConfig != nil and
if (llStr in toLogLevelMap) and getChalkScope() != nil and
(toLogLevelMap[llStr] <= toLogLevelMap[get[string](getChalkScope(), "chalk_log_level")]):
return (msg, true)

Expand Down Expand Up @@ -148,7 +148,7 @@ proc ioErrorHandler(cfg: SinkConfig, t: Topic, msg, err, tb: string) =
error(toOut)
else:
trace(toOut)
if chalkConfig != nil and get[bool](getChalkScope(), "chalk_debug"):
if getChalkScope() != nil and get[bool](getChalkScope(), "chalk_debug"):
publish("debug", tb)

proc successHandler(cfg: SinkConfig, t: Topic, errmsg: string) =
Expand Down

0 comments on commit db0537e

Please sign in to comment.