docs: private IOException checkForErrors(long numBytes, boolean async) {
          IOException exception = null;
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "checkForErrors: numBytes=" + numBytes
                           + " buffers=" + SSLUtils.getBufferTraceInfo(getBuffers()));
          }
  
          // Extract the buffers provided by the calling channel.
          WsByteBuffer callerBuffers[] = getBuffers();
          if (callerBuffers == null || callerBuffers.length == 0) {
              exception = new IOException("No buffer(s) provided for writing data.");
          } else if ((numBytes < -1) || (numBytes == 0) && (async)) {
              // NumBytes requested must be -1 (write all) or positive
              exception = new IOException("Number of bytes requested, " + numBytes + " is not valid.");
          } else {
              // Ensure buffer provided by caller is big enough to contain the number of bytes requested.
              int bytesAvail = WsByteBufferUtils.lengthOf(callerBuffers);
              if (bytesAvail < numBytes) {
                  exception = new IOException("Number of bytes requested, "
                                              + numBytes + " exceeds space remaining in the buffers provided: "
                                              + bytesAvail);
              }
          }
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() && exception != null) {
              Tr.debug(tc, "Found error, exception generated: " + exception);
          }
          return exception;
      }