/** * Wraps this promise in a promise that will handle exceptions thrown by this Promise. * * @param function The function to handle the exception. This may, for example, convert the * exception into something of type <code>T</code>, or it may throw another exception, or it * may do some other handling. * @param ec The ExecutionContext to execute the function in. * @return A wrapped promise that will only throw an exception if the supplied <code>function * </code> throws an exception. */ public Promise<A> recover(final Function<Throwable, A> function, ExecutionContext ec) { return FPromiseHelper.recover(this, function, ec); }
/** * Wraps this promise in a promise that will handle exceptions thrown by this Promise. * * <p>The function will be run in the default execution context. * * @param function The function to handle the exception. This may, for example, convert the * exception into something of type <code>T</code>, or it may throw another exception, or it * may do some other handling. * @return A wrapped promise that will only throw an exception if the supplied <code>function * </code> throws an exception. */ public Promise<A> recover(final Function<Throwable, A> function) { return FPromiseHelper.recover(this, function, HttpExecution.defaultContext()); }