History

Instrument FileScraper read errors rather than use puts

Thibaut Courouble committed 8 years ago

Commit 00957791 parent 0725a692 files · +5 −1Browse files

Unified · Split

2 files
  1. lib/docs/core/scrapers/file_scraper.rb +1 −1
  2. lib/docs/subscribers/doc_subscriber.rb +4 −0
lib/docs/core/scrapers/file_scraper.rb+1−1
@@ -41,7 +41,7 @@ module Docs · 40 unmodified lines
41 def read_file(path)41 def read_file(path)
42 File.read(path)42 File.read(path)
43 rescue43 rescue
44 puts "Failed to open file: #{path}"44 instrument 'warn.doc', msg: "Failed to open file: #{path}"
45 nil45 nil
46 end46 end
47 end47 end
lib/docs/subscribers/doc_subscriber.rb+4−0
@@ -26,6 +26,10 @@ module Docs · 25 unmodified lines
26 log event.payload[:msg]26 log event.payload[:msg]
27 end27 end
28 28
29 def warn(event)
30 log "ERROR: #{event.payload[:msg]}"
31 end
32
29 def error(event)33 def error(event)
30 exception = event.payload[:exception]34 exception = event.payload[:exception]
31 log "ERROR:"35 log "ERROR:"