Class: Workers::Base

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/base.rb

Instance Method Summary collapse

Instance Method Details

#suppress_annoying_errors(&block) ⇒ Object

In the long term we need to eliminate the cause of these


12
13
14
15
16
17
18
19
20
# File 'app/workers/base.rb', line 12

def suppress_annoying_errors(&block)
  yield
rescue Diaspora::ContactRequiredUnlessRequest,
       Diaspora::RelayableObjectWithoutParent => e
  Rails.logger.info("error on receive: #{e.class}")
rescue ActiveRecord::RecordInvalid => e
  Rails.logger.info("failed to save received object: #{e.record.errors.full_messages}")
  raise e unless e.message.match(/already been taken/)
end