diff options
author | Jake Leahy <jake@leahy.dev> | 2023-12-17 22:30:11 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-17 12:30:11 +0100 |
commit | 9b08abaa0574c32f414c09bb4ef183739003884d (patch) | |
tree | 9604a5c33e874c8a86f688cb7d55a9e87fc52ea0 | |
parent | b3b87f0f8a8091c88461953d686f9772dfb3c4bc (diff) | |
download | Nim-9b08abaa0574c32f414c09bb4ef183739003884d.tar.gz |
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
-rw-r--r-- | lib/pure/unittest.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 2f3437ac7..cfb762258 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -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.} |