Skip to content

Commit

Permalink
Clarify chiselTests.Utils.extractCause Scaladoc
Browse files Browse the repository at this point in the history
Signed-off-by: Schuyler Eldridge <[email protected]>
  • Loading branch information
seldridge committed Jun 23, 2020
1 parent 5af61d8 commit b5e5989
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/test/scala/chiselTests/ChiselSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b5e5989

Please sign in to comment.