log error when receiving a post instead of letting the job fail with weired error later in the chain

This commit is contained in:
MrZYX 2011-04-02 17:44:48 +02:00
parent f98a4ee42c
commit 4b7c9315c8

View file

@ -91,11 +91,14 @@ class Post < ActiveRecord::Base
return local_post return local_post
end end
elsif !local_post elsif !local_post
self.save if self.save
user.contact_for(person).receive_post(self) user.contact_for(person).receive_post(self)
user.notify_if_mentioned(self) user.notify_if_mentioned(self)
Rails.logger.info("event=receive payload_type=#{self.class} update=false status=complete sender=#{self.diaspora_handle}") Rails.logger.info("event=receive payload_type=#{self.class} update=false status=complete sender=#{self.diaspora_handle}")
return self return self
else
Rails.logger.info("event=receive payload_type=#{self.class} update=false status=abort sender=#{self.diaspora_handle} reason=#{self.errors.full_messages}")
end
else else
Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason='update not from post owner' existing_post=#{self.id}") Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason='update not from post owner' existing_post=#{self.id}")
end end