Skip to content

Commit

Permalink
fix: add an error to catch
Browse files Browse the repository at this point in the history
Add ArgumentError to #doc because it has a possibility to throw the error
  • Loading branch information
ninoseki committed Apr 3, 2019
1 parent eb914a9 commit 19e7044
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/miteru/website.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ def get
end

def doc
@doc ||= [].tap do |out|
out << Oga.parse_html(response.body.to_s)
rescue LL::ParserError => _
out << nil
end.first
@doc ||= parse_html(response.body.to_s)
end

def parse_html(html)
Oga.parse_html(html)
rescue ArgumentError, LL::ParserError => _
nil
end

def links
Expand Down

0 comments on commit 19e7044

Please sign in to comment.