From f1d70dbb8c7b5e2474b0bd5ac52f42c8c4318fd2 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 17 Aug 2021 15:45:12 +0200 Subject: [PATCH] better error message on unexpected exception (#10) --- unittest2.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unittest2.nim b/unittest2.nim index cf2c55b..9693ed7 100644 --- a/unittest2.nim +++ b/unittest2.nim @@ -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)