Browse Source

Raise if auth is unsuccessful

master
Dylan Baker 2 years 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
     @first = first
13
     @first = first
14
     @last = last
14
     @last = last
15
     @log = log
15
     @log = log
16
-    @cookie = login(ENV['VLV_USERNAME'], ENV['VLV_PASSWORD'])
16
+
17
+    authenticate!
17
   end
18
   end
18
 
19
 
19
   def scrape
20
   def scrape
32
     end
33
     end
33
   end
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
   def scrape_thread(t)
44
   def scrape_thread(t)
36
     log t[:title]
45
     log t[:title]
37
 
46
 

Loading…
Cancel
Save