docs: private SQLException readErrorPacket(Buffer buffer, Results results) {
      removeHasMoreResults();
      this.hasWarnings = false;
      buffer.skipByte();
      final int errorNumber = buffer.readShort();
      String message;
      String sqlState;
      if (buffer.readByte() == '#') {
        sqlState = new String(buffer.readRawBytes(5));
        message = buffer.readStringNullEnd(StandardCharsets.UTF_8);
      } else {
        // Pre-4.1 message, still can be output in newer versions (e.g with 'Too many connections')
        buffer.position -= 1;
        message = new String(buffer.buf, buffer.position, buffer.limit - buffer.position,
            StandardCharsets.UTF_8);
        sqlState = "HY000";
      }
      results.addStatsError(false);
  
      //force current status to in transaction to ensure rollback/commit, since command may have issue a transaction
      serverStatus |= ServerStatus.IN_TRANSACTION;
  
      removeActiveStreamingResult();
      return new SQLException(message, sqlState, errorNumber);
    }