Catch

class Catch[+T](val pf: Catcher[T], val fin: Option[Finally], val rethrow: Throwable => Boolean) extends Described

A container class for catch/finally logic.

Pass a different value for rethrow if you want to probably unwisely allow catching control exceptions and other throwables which the rest of the world may expect to get through.

Type parameters:
T

result type of bodies used in try and catch blocks

Value parameters:
fin

Finally logic which if defined will be invoked after catch logic

pf

Partial function used when applying catch logic to determine result value

rethrow

Predicate on throwables determining when to rethrow a caught Throwable

Source:
Exception.scala
trait Described
class Object
trait Matchable
class Any

Value members

Concrete methods

def andFinally(body: => Unit): Catch[T]

Create a new Catch container from this object and the supplied finally body.

Create a new Catch container from this object and the supplied finally body.

Value parameters:
body

The additional logic to apply after all existing finally bodies

Source:
Exception.scala
def apply[U >: T](body: => U): U

Apply this catch logic to the supplied body.

Apply this catch logic to the supplied body.

Source:
Exception.scala
def either[U >: T](body: => U): Either[Throwable, U]

Apply this catch logic to the supplied body, mapping the result into Either[Throwable, T] - Left(exception) if an exception was caught, Right(T) otherwise.

Apply this catch logic to the supplied body, mapping the result into Either[Throwable, T] - Left(exception) if an exception was caught, Right(T) otherwise.

Source:
Exception.scala
def opt[U >: T](body: => U): Option[U]

Apply this catch logic to the supplied body, mapping the result into Option[T] - None if any exception was caught, Some(T) otherwise.

Apply this catch logic to the supplied body, mapping the result into Option[T] - None if any exception was caught, Some(T) otherwise.

Source:
Exception.scala
def or[U >: T](pf2: Catcher[U]): Catch[U]

Create a new Catch with additional exception handling logic.

Create a new Catch with additional exception handling logic.

Source:
Exception.scala
def or[U >: T](other: Catch[U]): Catch[U]

Convenience methods.

Convenience methods.

Source:
Exception.scala
def withApply[U](f: Throwable => U): Catch[U]

Create a Catch object with the same isDefinedAt logic as this one, but with the supplied apply method replacing the current one.

Create a Catch object with the same isDefinedAt logic as this one, but with the supplied apply method replacing the current one.

Source:
Exception.scala
def withTry[U >: T](body: => U): Try[U]

Apply this catch logic to the supplied body, mapping the result into Try[T] - Failure if an exception was caught, Success(T) otherwise.

Apply this catch logic to the supplied body, mapping the result into Try[T] - Failure if an exception was caught, Success(T) otherwise.

Source:
Exception.scala

Inherited methods

Inherited from:
Described
Source:
Exception.scala
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Returns:

a string representation of the object.

Definition Classes
Inherited from:
Described
Source:
Exception.scala
def withDesc(s: String): Catch[T]
Inherited from:
Described
Source:
Exception.scala

Concrete fields

val pf: Catcher[T]