Skip to content

Commit

Permalink
Merge pull request #91 from transitland/feed-imports-log-exceptions
Browse files Browse the repository at this point in the history
Feed imports log exceptions
  • Loading branch information
drewda committed May 29, 2015
2 parents bbfc2be + 8c475e8 commit 2f27468
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/workers/feed_eater_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,23 @@ def perform(feed_onestop_ids = [])
logger.info "5. Creating GTFS artifact: #{feed_onestop_id}"
run_python('./lib/feedeater/artifact.py', "--log #{log_file_path} #{feed_onestop_id}")
# TODO: upload GTFS artifact to S3
# what happens with a human-readable index.html?
rescue
logger.error $!
logger.error $!.backtrace
rescue Exception => e
# NOTE: we're catching all exceptions, including Interrupt, SignalException, and SyntaxError
exception_log = "\n#{e}\n#{e.backtrace}\n"
logger.error exception_log
feed_import.update(success: false)
Raven.capture_exception(e) if defined?(Raven)
else
feed.has_been_fetched_and_imported!(on_feed_import: feed_import)
ensure
# Report
if File.exist?(log_file_path)
import_log = File.open(log_file_path, 'r').read
else
import_log = nil
import_log = ''
end
if exception_log.present?
import_log << exception_log
end
if File.exist?(validation_report_path)
validation_report = File.open(validation_report_path, 'r').read
Expand Down

0 comments on commit 2f27468

Please sign in to comment.