Returns the value from this Return or throws the exception if this is a Throw
Returns true if this Try is a Return and the predicate p returns true when applied to its value.
Converts this to a Throw if the predicate does not obtain.
Returns the given function applied to the value from this Return or returns this if this is a Throw.
Returns the given function applied to the value from this Return or returns this if this is a Throw.
Note The gnarly type parameterization is there for Java compatibility, since Java does not support higher-kinded types.
Calls the exceptionHandler with the exception if this is a Throw.
Calls the exceptionHandler with the exception if this is a Throw. This is like map for the exception.
Returns true if the Try is a Return, false otherwise.
Returns true if the Try is a Throw, false otherwise.
Maps the given function to the value from this Return or returns this if this is a Throw
Invoke the function on the error, if the computation was unsuccessful.
Invoke the function on the error, if the computation was
unsuccessful. Returns a chained this
as in respond
.
Invoked only if the computation was successful.
Invoked only if the computation was successful. Returns a
chained this
as in respond
.
Calls the exceptionHandler with the exception if this is a Throw.
Calls the exceptionHandler with the exception if this is a Throw. This is like flatMap for the exception.
Note The gnarly type parameterization is there for Java compatibility, since Java does not support higher-kinded types.
Returns the throwable if this is a Throw, else raises IllegalStateException.
Returns the throwable if this is a Throw, else raises IllegalStateException.
Callers should consult isThrow() prior to calling this method to determine whether or not this is a Throw.
This method is intended for Java compatibility. Scala consumers are encouraged to pattern match for Throw(t).
Converts this to a Throw if the predicate does not obtain.
Returns the given function applied to the value from this Return or returns this if this is a Throw.
Returns the given function applied to the value from this Return or returns this if this is a Throw. Alias for flatMap
Invoked regardless of whether the computation completed successfully or unsuccessfully.
Invoked regardless of whether the computation completed
successfully or unsuccessfully. Implemented in terms of
respond
so that subclasses control evaluation order. Returns a
chained this
as in respond
.
Applies the given function f if this is a Result.
Returns the value from this Return or throws the exception if this is a Throw.
Returns the value from this Return or throws the exception if this is a Throw. Alias for apply()
Returns the value from this Return or the given argument if this is a Throw.
Invokes the given closure when the value is available.
Invokes the given closure when the value is available. Returns another 'This[R]' that is guaranteed to be available only *after* 'k' has run. This enables the enforcement of invocation ordering.
Returns None if this is a Throw or a Some containing the value if this is a Return
Invokes the given transformation when the value is available, returning the transformed value.
Invokes the given transformation when the value is available, returning the transformed value. This method is like a combination of flatMap and rescue. This method is typically used for more imperative control-flow than flatMap/rescue which often exploits the Null Object Pattern.
This class represents a computation that can succeed or fail. It has two concrete implementations, Return (for success) and Throw (for failure)