scala.util.control.Exception

class Catch

[source: scala/util/control/Exception.scala]

class Catch[+T](val pf : PartialFunction[T], val fin : Option[Finally])
extends Described
A container class for catch/finally logic.
Additional Constructor Summary
def this (pf : PartialFunction[T]) : Catch[T]
Value Summary
protected val name : java.lang.String
Method Summary
def andFinally (body : => Unit) : Catch[T]
def apply [U >: T](body : => U) : U
Apply this catch logic to the supplied body.
def either [U >: T](body : => U) : Either[java.lang.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.
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.
def or [U >: T](pf2 : PartialFunction[U]) : Catch[U]
Create a new Catch with additional exception handling logic.
def or [U >: T](other : Catch[U]) : Catch[U]
def toEither : Catch[Either[java.lang.Throwable, T]]
def toOption : Catch[Option[T]]
Convenience methods.
def withApply [U](f : (java.lang.Throwable) => U) : Catch[U]
Create a new Catch with the same isDefinedAt logic as this one, but with the supplied apply method replacing the current one.
Methods inherited from Described
desc, withDesc, toString
Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Additional Constructor Details
def this(pf : PartialFunction[T]) : Catch[T]

Value Details
protected val name : java.lang.String
Overrides
Described.name

Method Details
def or[U >: T](pf2 : PartialFunction[U]) : Catch[U]
Create a new Catch with additional exception handling logic.

def or[U >: T](other : Catch[U]) : Catch[U]

def apply[U >: T](body : => U) : U
Apply this catch logic to the supplied body.

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

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.

def either[U >: T](body : => U) : Either[java.lang.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.

def withApply[U](f : (java.lang.Throwable) => U) : Catch[U]
Create a new Catch with the same isDefinedAt logic as this one, but with the supplied apply method replacing the current one.

def toOption : Catch[Option[T]]
Convenience methods.

def toEither : Catch[Either[java.lang.Throwable, T]]