ソースを参照

Raise if auth is unsuccessful

master
Dylan Baker 2年前
コミット
0a58dd5c89
1個のファイルの変更10行の追加1行の削除
  1. 10
    1
      db/scrape.rb

+ 10
- 1
db/scrape.rb ファイルの表示

@@ -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
 

読み込み中…
キャンセル
保存