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
249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/grubby/scraper.rb', line 249 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
247 248 249 |
# File 'lib/grubby/scraper.rb', line 247 def scraper @scraper end |