Instrument FileScraper read errors rather than use puts

pull/775/head
Thibaut Courouble 7 years ago
parent 0725a69af5
commit 0095779b3f

@ -41,7 +41,7 @@ module Docs
def read_file(path) def read_file(path)
File.read(path) File.read(path)
rescue rescue
puts "Failed to open file: #{path}" instrument 'warn.doc', msg: "Failed to open file: #{path}"
nil nil
end end
end end

@ -26,6 +26,10 @@ module Docs
log event.payload[:msg] log event.payload[:msg]
end end
def warn(event)
log "ERROR: #{event.payload[:msg]}"
end
def error(event) def error(event)
exception = event.payload[:exception] exception = event.payload[:exception]
log "ERROR:" log "ERROR:"

Loading…
Cancel
Save