Showing the changes to lib/docs (2 of 4 files). Show all
Unified · Split
| @@ -163,8 +163,12 @@ module Docs · 162 unmodified lines | |||
| 163 | instrument 'ignore_response.scraper', response: response | 163 | instrument 'ignore_response.scraper', response: response |
| 164 | end | 164 | end |
| 165 | rescue => e | 165 | rescue => e |
| 166 | puts "URL: #{response.url}" | 166 | if Docs.rescue_errors |
| 167 | raise e | 167 | instrument 'error.doc', exception: e, url: response.url |
| 168 | nil | ||
| 169 | else | ||
| 170 | raise e | ||
| 171 | end | ||
| 168 | end | 172 | end |
| 169 | 173 | ||
| 170 | def process_response(response) | 174 | def process_response(response) |
| @@ -20,6 +20,15 @@ module Docs · 19 unmodified lines | |||
| 20 | log event.payload[:msg] | 20 | log event.payload[:msg] |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | def error(event) | ||
| 24 | exception = event.payload[:exception] | ||
| 25 | log "ERROR:" | ||
| 26 | puts " #{event.payload[:url]}" | ||
| 27 | puts " #{exception.class}: #{exception.message.gsub("\n", "\n ")}" | ||
| 28 | puts exception.backtrace.select { |line| line.start_with?(Docs.root_path) }.join("\n ").prepend("\n ") | ||
| 29 | puts "\n" | ||
| 30 | end | ||
| 31 | |||
| 23 | private | 32 | private |
| 24 | 33 | ||
| 25 | def parse_payload(event) | 34 | def parse_payload(event) |