Companion object to class Exceptional that provides a factory method and an extractor that enables
patterns that match both Failed and Canceled outcomes and
extracts the contained exception and a factory method.
- Companion:
- class
Type members
Value members
Concrete methods
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
}
}
- Returns:
a
FailedorCanceledcontaining 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
}
}
- Value parameters:
- res
the
Outcometo extract the throwable from.
- Returns:
a
Somewrapping the contained throwable ifresis an instance of eitherFailedorCanceled, elseNone.