move echo statement for internal stacktrace into if branch

No need to echo internal stacktrace, if there is no parent to echo for.
This commit is contained in:
Vindaar 2018-10-12 09:01:20 +02:00 committed by flyx
parent 8a7750cb6c
commit 1babb26616
1 changed files with 2 additions and 2 deletions

View File

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