Exception: Grubby::Scraper::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Grubby::Scraper::Error
- Defined in:
- lib/grubby/scraper.rb
Constant Summary collapse
- BACKTRACE_CLEANER =
ActiveSupport::BacktraceCleaner.new.tap do |cleaner| cleaner.add_silencer do |line| line.include?(__dir__) && line.include?("scraper.rb:") end end
Instance Attribute Summary collapse
-
#scraper ⇒ Grubby::Scraper
The Scraper that raised this error.
Instance Method Summary collapse
-
#initialize(scraper) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(scraper) ⇒ Error
110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/grubby/scraper.rb', line 110 def initialize(scraper) self.scraper = scraper listing = scraper.errors. reject{|field, error| error.is_a?(FieldScrapeFailedError) }. map do |field, error| "* `#{field}` (#{error.class})\n" + error..indent(2) + "\n\n" + BACKTRACE_CLEANER.clean(error.backtrace).join("\n").indent(4) + "\n" end. join("\n") super("Failed to scrape the following fields:\n#{listing}") end |
Instance Attribute Details
#scraper ⇒ Grubby::Scraper
108 109 110 |
# File 'lib/grubby/scraper.rb', line 108 def scraper @scraper end |