title: Return a variable from a begin rescue error
body: <p>The method</p>
  
  <pre><code>def exp_backoff up_to, url, header = {}                                                                                      
    tries = 0                                                                                                                  
    begin                                                                                                                      
      tries += 1                                                                                                               
      response = JSON.parse(open(url, header).read)                                                                            
  
      return response                                                                                                          
    rescue OpenURI::HTTPError =&gt; e                                                                                             
      if tries &lt; up_to                                                                                                         
        sleep( 2 ** tries )                                                                                                    
        retry                                                                                                                  
      else                                                                                                                     
        return e                                                                                                               
      end                                                                                                                      
    end                                                                                                                        
  end   
  </code></pre>
  
  <p>I'm calling <code>exp_backoff</code> expecting response to be returned, but it is not</p>
  
  <pre><code>  exp_backoff 2, status_url                                                                                                  
    session_token = response['session_token']
  </code></pre>
  
  <p>Getting this error</p>
  
  <pre><code>undefined local variable or method `response' for main:Object (NameError)
  </code></pre>