Refactoring: Improved logging of exceptions by using standardized way.

This commit is contained in:
Thorsten Eckel 2018-11-27 10:56:23 +01:00 committed by Martin Edenhofer
parent d7401b6a57
commit eed5fe1459
3 changed files with 7 additions and 10 deletions

View file

@ -62,7 +62,7 @@ fetch one account
rescue => e
error = "Can't use Channel::Driver::#{adapter.to_classname}: #{e.inspect}"
logger.error error
logger.error e.backtrace
logger.error e
self.status_in = 'error'
self.last_log_in = error
preferences[:last_fetch] = Time.zone.now
@ -102,7 +102,7 @@ stream instance of account
rescue => e
error = "Can't use Channel::Driver::#{adapter.to_classname}: #{e.inspect}"
logger.error error
logger.error e.backtrace
logger.error e
self.status_in = 'error'
self.last_log_in = error
save!
@ -204,7 +204,7 @@ stream all accounts
rescue => e
error = "Can't use stream for channel (#{channel.id}): #{e.inspect}"
logger.error error
logger.error e.backtrace
logger.error e
channel.status_in = 'error'
channel.last_log_in = error
channel.save!
@ -261,7 +261,7 @@ send via account
rescue => e
error = "Can't use Channel::Driver::#{adapter.to_classname}: #{e.inspect}"
logger.error error
logger.error e.backtrace
logger.error e
self.status_out = 'error'
self.last_log_out = error
save!
@ -297,7 +297,7 @@ process via account
rescue => e
error = "Can't use Channel::Driver::#{adapter.to_classname}: #{e.inspect}"
logger.error error
logger.error e.backtrace
logger.error e
self.status_in = 'error'
self.last_log_in = error
save!

View file

@ -61,9 +61,7 @@ class Observer::Transaction < ActiveRecord::Observer
integration = backend.new(item, params)
integration.perform
rescue => e
Rails.logger.error 'ERROR: ' + backend.inspect
Rails.logger.error 'ERROR: ' + e.inspect
Rails.logger.error e.backtrace.inspect
Rails.logger.error e
end
end

View file

@ -440,8 +440,7 @@ get count of tickets and tickets which match on selector
return [ticket_count, tickets]
rescue ActiveRecord::StatementInvalid => e
Rails.logger.error e.inspect
Rails.logger.error e.backtrace
Rails.logger.error e
raise ActiveRecord::Rollback
end
end