more error handling

pull/1/head
Jared Cosulich 8 years ago
parent 15eba2c9fc
commit 234c40e6f7

@ -200,7 +200,7 @@ namespace :data do
name: "Survey Respondent Id: #{respondent_id}" name: "Survey Respondent Id: #{respondent_id}"
) )
rescue rescue
puts "DATAERROR: ERROR AT #{index} - #{district.name} - #{school_name} #{school}: #{respondent_id}" puts "DATAERROR: INDEX: #{index} ERROR AT #{index} - #{district.name} - #{school_name} #{school}: #{respondent_id}"
end end
respondent_map[respondent_id] = recipient.id respondent_map[respondent_id] = recipient.id
end end
@ -221,7 +221,7 @@ namespace :data do
begin begin
question = Question.find_by_text(key) question = Question.find_by_text(key)
rescue Exception => e rescue Exception => e
puts "DATAERROR: Failed finding question: #{key} -> #{e}" puts "DATAERROR: INDEX: #{index} Failed finding question: #{key} -> #{e}"
end end
if question.nil? if question.nil?
@ -255,7 +255,7 @@ namespace :data do
begin begin
recipient.attempts.create(question: question, answer_index: answer_index, responded_at: responded_at) recipient.attempts.create(question: question, answer_index: answer_index, responded_at: responded_at)
rescue Exception => e rescue Exception => e
puts "DATAERROR: Attempt failed for #{recipient} -> QUESTION: #{question}, ANSWER_INDEX: #{answer_index}, RESPONDED_AT: #{responded_at}, ERROR: #{e}" puts "DATAERROR: INDEX: #{index} Attempt failed for #{recipient.inspect} -> QUESTION: #{question.inspect}, ANSWER_INDEX: #{answer_index}, RESPONDED_AT: #{responded_at}, ERROR: #{e}"
next next
end end
end end

Loading…
Cancel
Save