Skip to content

Commit

Permalink
Raise an error when video does not have view count
Browse files Browse the repository at this point in the history
  • Loading branch information
kangkyu committed Jun 7, 2018
1 parent 1a82b12 commit e4b493a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/funky/errors.rb
@@ -1,4 +1,5 @@
module Funky
class ContentNotFound < StandardError; end
class ConnectionError < StandardError; end
class CountersNotFound < StandardError; end
end
1 change: 1 addition & 0 deletions lib/funky/video.rb
Expand Up @@ -115,6 +115,7 @@ def self.where(id:)
# and encapsulated into a Funky::Video object.
def self.find(video_id)
counters = @@html_parser.parse html: @@html_page.get(video_id: video_id), video_id: video_id
raise CountersNotFound, "View count not found with video ID #{video_id}" unless counters[:view_count]
new counters.merge(id: video_id)
end

Expand Down

0 comments on commit e4b493a

Please sign in to comment.