echo internal stack trace if not release, check if parent is nil

This commit is contained in:
Vindaar 2018-10-11 14:21:12 +02:00 committed by flyx
parent a211eab2c6
commit ba06599b7d
1 changed files with 6 additions and 6 deletions

View File

@ -15,9 +15,9 @@ template internalError*(s: string) =
echo "[NimYAML] Stacktrace:" echo "[NimYAML] Stacktrace:"
try: try:
writeStackTrace() writeStackTrace()
when defined(debug):
echo "Internal stacktrace:" echo "Internal stacktrace:"
let exc = getCurrentException() let exc = getCurrentException()
if not isNil(exc.parent):
echo getStackTrace(exc.parent) echo getStackTrace(exc.parent)
except: discard except: discard
echo "[NimYAML] Please report this bug." echo "[NimYAML] Please report this bug."
@ -33,9 +33,9 @@ template yAssert*(e: typed) =
echo "[NimYAML] Stacktrace:" echo "[NimYAML] Stacktrace:"
try: try:
writeStackTrace() writeStackTrace()
when defined(debug):
echo "Internal stacktrace:" echo "Internal stacktrace:"
let exc = getCurrentException() let exc = getCurrentException()
if not isNil(exc.parent):
echo getStackTrace(exc.parent) echo getStackTrace(exc.parent)
except: discard except: discard
echo "[NimYAML] Please report this bug." echo "[NimYAML] Please report this bug."