public static <T> Try<T> toTry(final Promise<T> promise) {
    if (promise.isFailed()) {
      return Failure.of(promise.getError());
    } else {
      return Success.of(promise.get());
    }
  }
public static <T> Try<T> toTry(final Promise<T> promise) {
    if (promise.isFailed()) {
      return Failure.of(promise.getError());
    } else {
      return Success.of(promise.get());
    }
  }
public static < T > Try < T > toTry ( final Promise < T > promise ) { if ( promise . isFailed ( ) ) { return Failure . of ( promise . getError ( ) ) ; } else { return Success . of ( promise . get ( ) ) ; } }
Returns instance of {@link Try} that represents result a promise has completed with.
This method throws {@link PromiseUnresolvedException} if teh promise has not been resolved yet.

@return instance of {@link Try} that represents result the promise has completed with
@see Try
Returns instance of { @link Try } that represents result a promise has completed with . This method throws { @link PromiseUnresolvedException } if teh promise has not been resolved yet .