code: private ChannelFuture checkException(ChannelPromise promise) {
        Throwable t = lastException;
        if (t != null) {
          lastException = null;
  
          if (promise.isVoid()) {
              PlatformDependent.throwException(t);
          }
  
          return promise.setFailure(t);
        }
  
        return promise.setSuccess();
      }
docs: Checks for the presence of an {@link Exception}.