title: Rails exception handeling in custom module
body: <p>I have a module in a lib/assets file as follows:</p>
  
  <pre><code>require 'net/http'
  require 'cgi'
  require 'json'
  
   module FetchRec
    rate.sample(5).each do |result|
      begin
        url = URI.parse("http://www.url.com/dprc=Y&amp;item_id=#{result["item"]}")
       rescue
          next 
        end
       r = JSON.parse(Net::HTTP.get_response(url).body)
    end
  </code></pre>
  
  <p>When I start my server I get an exception: Syntax Error -- "Invalid next" </p>
  
  <p>How can I handle exceptions in this module, so that if a url is not valid, the json parse script will skip to the next url, and parse that?</p>