implicit final class TryOps[A] extends AnyVal
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- TryOps
- AnyVal
- Any
- Hide All
- Show All
Visibility
- Public
- All
Instance Constructors
- new TryOps(aTry: Try[A])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
collectFail(pf: PartialFunction[Throwable, Throwable]): Try[A]
The given function is applied if this is a
Failure.The given function is applied if this is a
Failure. The contained throwable is used as cause for the provided one.Failure(NotFound).collectFail { case NotFound => UrlNotFound } // Result: Failure(UrlNotFound(cause = NotFound)) Failure(NotAString).collectFail { case NotFound => UrlNotFound } // Result: Failure(NotAString) Success(12).collectFail { case NotFound => UrlNotFound } // Result: Success(12) -
def
failAs(t: ⇒ Throwable): Try[A]
Transforms the inner
Throwableto the provided one if this is a failure.Transforms the inner
Throwableto the provided one if this is a failure. The contained throwable is used as cause for the provided one.Failure(NotFound).failAs(UrlNotFound) // Result: Failure(UrlNotFound(cause = NotFound)) Try(12).failAs(NotFound) // Result: Success(12)
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
def
getOrThrow(implicit logger: Logger): A
Retrieves the value inside this
Tryor logs/throws the error. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mapFail(pf: (Throwable) ⇒ Throwable): Try[A]
The given function is applied if this is a
Failure.The given function is applied if this is a
Failure. The contained throwable is used as cause for the provided one.Failure(NotFound).mapFail(_ => UrlNotFound) // Result: Failure(UrlNotFound(cause = NotFound)) Success(12).mapFail(_ => UrlNotFound) // Result: Success(12)
-
def
toString(): String
- Definition Classes
- Any