How can I show the exception's message as a clue w...
# kotest
s
How can I show the exception's message as a clue with
shouldNotThrowAny
?
s
Isn't that matcher just the same as not having one
s
Not quite, as it swallows the original exception message it seems:
Copy code
inline fun <T> shouldNotThrowAny(block: () -> T): T {
   assertionCounter.inc()

   val thrownException = try {
      return block()
   } catch (e: Throwable) {
      e
   }

   throw failure(
      "No exception expected, but a ${thrownException::class.simpleName} was thrown.",
      thrownException
   )
}