You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: manual_offset_with_error_every_bang_spec.rb
    path of file: ./repos/karafka/spec/integrations/consumption/strategies/mom
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# When manual offset management is on, upon error Karafka
    
  def consume
    @consumed ||= 0

    messages.each do |message|
      @consumed += 1

      raise StandardError if @consumed == 50

      DT[0] << message.raw_payload

      mark_as_consumed!(message)
    end
  end