code: @ObjectiveCName("failure:")
      public synchronized Promise<T> failure(final Consumer<Exception> failure) {
          if (isFinished) {
              if (exception != null) {
                  dispatcher.dispatch(() -> failure.apply(exception));
              }
          } else {
  
              callbacks.add(new PromiseCallback<T>() {
                  @Override
                  public void onResult(T t) {
                      // Do nothing
                  }
  
                  @Override
                  public void onError(Exception e) {
                      failure.apply(e);
                  }
              });
          }
          return this;
      }
docs: Handling failure
  
  @param failure supplier for exception
  @return this