better error message on unexpected exception (#10)

This commit is contained in:
Jacek Sieka 2021-08-17 15:45:12 +02:00 committed by GitHub
parent 4c2ce01e34
commit f1d70dbb8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -965,8 +965,9 @@ macro expect*(exceptions: varargs[typed], body: untyped): untyped =
fail()
except errorTypes:
discard
except:
checkpoint(lineInfoLit & ": Expect Failed, unexpected exception was thrown.")
except Exception as e:
checkpoint(lineInfoLit & ": Expect Failed, unexpected " & $e.name &
" (" & e.msg & ") was thrown.\n" & e.getStackTrace())
fail()
var errorTypes = newNimNode(nnkBracket)