Fixed exception reporting and small test builder bug

This commit is contained in:
Productive2 2021-02-08 18:35:57 +01:00
parent bfb57b1552
commit b5927df998
2 changed files with 4 additions and 2 deletions

View File

@ -56,7 +56,7 @@ proc log*(level: LogLevel, msg: string) =
setForegroundColor(fgDefault)
proc fatal*(msg: string) =
write stderr, msg
echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
log(LogLevel.Fatal, msg)
raise newException(CatchableError, msg)

View File

@ -26,7 +26,7 @@ proc parseModalLine(line: string): tuple[modal: bool, mode: string, detail: stri
result.modal = false
result.mode = ""
result.detail = ""
if line[0] == '[':
if line.len() > 0 and line[0] == '[':
result.modal = true
else:
return result
@ -144,6 +144,8 @@ proc buildTests*(testDir: string): seq[Test] =
try:
result &= buildTestFile(candidate)
except:
write stderr, getCurrentExceptionMsg()
write stderr, getCurrentException().getStacktrace()
log(LogLevel.Error, &"Building test file {candidate} failed")