Module: Myimdb::HandleExceptions::ClassMethods
- Defined in:
- lib/myimdb/scraper/base.rb
Instance Method Summary collapse
Instance Method Details
#handle_exceptions_for(*method_names) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/myimdb/scraper/base.rb', line 17 def handle_exceptions_for(*method_names) method_names.each do |method_name| alias_method("_#{method_name}", method_name) define_method(method_name) do begin send("_#{method_name}") rescue if EXCEPTIONS_ENABLED raise UnformattedHtml.new("Unable to find tag: #{method_name}, probably you are parsing the wrong page.") else nil end end end end end |