From b5e59895e13550006fd8e951b7e9483de00f82dd Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Mon, 22 Jun 2020 19:59:44 -0400 Subject: Clarify chiselTests.Utils.extractCause Scaladoc Signed-off-by: Schuyler Eldridge --- src/test/scala/chiselTests/ChiselSpec.scala | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/test') diff --git a/src/test/scala/chiselTests/ChiselSpec.scala b/src/test/scala/chiselTests/ChiselSpec.scala index 04c35f32..2ee6fbcf 100644 --- a/src/test/scala/chiselTests/ChiselSpec.scala +++ b/src/test/scala/chiselTests/ChiselSpec.scala @@ -270,11 +270,19 @@ trait Utils { } } - /** Run some code extracting an exception cause that matches a type parameter + /** Run some code and rethrow an exception with a specific type if an exception of that type occurs anywhere in the + * stack trace. + * + * This is useful for "extracting" one exception that may be wrapped by other exceptions. + * + * Example usage: + * {{{ + * a [ChiselException] should be thrownBy extractCause[ChiselException] { /* ... */ } + * }}} + * * @param thunk some code to run - * @tparam A the type of the exception to expect + * @tparam A the type of the exception to extract * @return nothing - * @throws the exception of type parameter A if it was found */ def extractCause[A <: Throwable : ClassTag](thunk: => Any): Unit = { def unrollCauses(a: Throwable): Seq[Throwable] = a match { -- cgit v1.2.3