Show the name of the unexpected exception that was thrown in std/unittest (#23087)

Show name of error that wasn't expected in an `expect` block
This commit is contained in:
Jake Leahy
2023-12-17 22:30:11 +11:00
committed by GitHub
parent b3b87f0f8a
commit 9b08abaa05

View File

@@ -773,7 +773,8 @@ macro expect*(exceptions: varargs[typed], body: untyped): untyped =
except errorTypes:
discard
except:
checkpoint(lineInfoLit & ": Expect Failed, unexpected exception was thrown.")
let err = getCurrentException()
checkpoint(lineInfoLit & ": Expect Failed, " & $err.name & " was thrown.")
fail()
{.pop.}