<commit_before>Spree::Api::ProductsController.class_eval do
  def update_redbox
    redbox_product = Redbox::Product.find(params[:id])
    migrator = Redbox::Migrate::Product.new
    @product = migrator.migrate_product(redbox_product)
  end
end<commit_msg>Check if product exists in redbox before migrating.<commit_after>Spree::Api::ProductsController.class_eval do
  def update_redbox
    redbox_product = Redbox::Product.find(product_id: params[:id])
    if redbox_product.nil?
      raise "Redbox product with id #{params[:id]} do not exists"
    end
    migrator = Redbox::Migrate::Product.new
    @product = migrator.migrate_product(redbox_product)
  end
end
{'fraction_non_alphanumeric': 0.10256410256410256, 'fraction_numerical': 0.0, 'mean_word_length': 5.3238095238095235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493590', 'n_tokens_mistral': 217, 'n_tokens_neox': 213, 'n_words': 43}