Skip to content

skimr: Confusing error message when using an improperly named block #5

Description

@nilbus

Trying to use the new skimr rewrite, and I tried use one of the old scrubyt examples, not knowing that things aren't the same way anymore. Spent a long time debugging, just to find out that the nil object error was insignificant, and that I was passing a block to a nonexistent function. The traceback and error did not show the name of the function I was calling

The following code generated the following traceback:

@extractor = Scrubyt::Extractor.new do
fetch 'http://theninthcut.com/anime'
record do # Could also be "doesntExist do", for the same results.
year '2010'
item_name 'Okamikakushi'
end
next_page 'next >>'
end

NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.sub
from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/results_extraction.rb:292:in clean_xpath' from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/results_extraction.rb:122:inevaluate_xpath'
from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/results_extraction.rb:160:in extract_detail' from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/results_extraction.rb:159:inmap'
from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/results_extraction.rb:159:in extract_detail' from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/extractor.rb:60:inmethod_missing'
from (irb):5:in boom' from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/extractor.rb:41:ininstance_eval'
from /home/nilbus/git/theninthcut/vendor/plugins/scrubyt-skimr/lib/scrubyt/extractor.rb:41:in initialize' from (irb):3:innew'
from (irb):3:in `boom'
from (irb):12

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions