title: Ruby rescue and retry specific code block
body: <p>I have the following code in my script...</p>
  
  <pre><code>  begin
      #Loop to create 1000 emails...
      #Loop to send 1000 emails...
  
    rescue Timeout::Error =&gt; e
      retry_attempts += 1
      if retry_attempts &lt; 10
        retry
      else
        puts "Timeout error, deleting emails...".red
        logs.puts("Rescued a timeout error...#{e}")
        email_ids_all.each do |email_delete|
          #delete all email...
        end
  </code></pre>
  
  <p>My question is what <code>retry</code> is actually going to "retry". If the script has already generated 1000 emails in one loop and sent 999 of them in another loop, and then it times out on sending the 1000th email- Will it retry the specific line of code it encountered the error on, will it start the loop over with the 1000th email, will it start the entire loop over, or will it start at the beginning of the script running through both loops?</p>
  
  <p>I am using ruby 1.9.3.</p>