lib/mail_spy/manager.rb in mail_spy-0.0.9 vs lib/mail_spy/manager.rb in mail_spy-0.0.10

- old
+ new

@@ -18,11 +18,12 @@ # Ensure that the campaign, stream and component are not blank # These keys are used to define the s3 paths for the templates [:campaign, :stream, :component].each { |key| raise "##{key} can't be blank" if options[key].blank? } # Make sure we have someone to send to - has_sender = options.keys.select { |option| to_options.include? option.intern }.present? + # TODO need to test setting the options but filling with nil + has_sender = to_options.select { |option| options[option].present? }.present? raise "Email instance has no sender (to,cc,bcc were all blank)" unless has_sender # Make sure that all options passed map to a accessor so we don't errantly # think we are passing something correctly and really its getting silently # ignored @@ -94,11 +95,11 @@ mail.deliver email.update_attribute(:sent, true) sent += 1 rescue Exception => e email.failed = true - email.error_message = e.message - email.error_backtrace = e.backtrace + email.error_message = e.try(:message) + email.error_backtrace = e.try(:backtrace) email.save! end end offset += step end