Browse Source

Raise if auth is unsuccessful

master
Dylan Baker 6 months ago
parent
commit
0a58dd5c89
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      db/scrape.rb

+ 10
- 1
db/scrape.rb View File

@@ -13,7 +13,8 @@ class Scraper
13 13
     @first = first
14 14
     @last = last
15 15
     @log = log
16
-    @cookie = login(ENV['VLV_USERNAME'], ENV['VLV_PASSWORD'])
16
+
17
+    authenticate!
17 18
   end
18 19
 
19 20
   def scrape
@@ -32,6 +33,14 @@ class Scraper
32 33
     end
33 34
   end
34 35
 
36
+  private
37
+
38
+  def authenticate!
39
+    @cookie = login(ENV['VLV_USERNAME'], ENV['VLV_PASSWORD'])
40
+
41
+    raise "Error logging into VLV. Check your credentials." if @cookie.nil?
42
+  end
43
+
35 44
   def scrape_thread(t)
36 45
     log t[:title]
37 46
 

Loading…
Cancel
Save