Creates an Exceptional instance given the passed Throwable.
Creates an Exceptional instance given the passed Throwable.
If the passed Throwable is an instance of TestCanceledException, this
method will return Canceled containing that TestCanceledException. Otherwise,
it returns a Failed containing the Throwable.
For example, trait SeveredStackTraces uses this
factory method to sever the stack trace of the exception contained in either a Failed and Canceled
like this:
abstract override def withFixture(test: NoArgTest): Outcome = {
super.withFixture(test) match {
case Exceptional(e: StackDepth) => Exceptional(e.severedAtStackDepth)
case o => o
}
}
a Failed or Canceled containing the passed exception.
Extractor enabling patterns that match both Failed and Canceled outcomes,
extracting the contained exception.
Extractor enabling patterns that match both Failed and Canceled outcomes,
extracting the contained exception.
For example, trait SeveredStackTraces uses this
extractor to sever the stack trace of the exception contained in either a Failed and Canceled
like this:
abstract override def withFixture(test: NoArgTest): Outcome = {
super.withFixture(test) match {
case Exceptional(e: StackDepth) => Exceptional(e.severedAtStackDepth)
case o => o
}
}
the Outcome to extract the throwable from.
a Some wrapping the contained throwable if res is an instance of
either Failed or Canceled, else None.
Companion object to class
Exceptionalthat provides a factory method and an extractor that enables patterns that match bothFailedandCanceledoutcomes and extracts the contained exception and a factory method.