demarches-normaliennes/app/jobs/application_job.rb

22 lines
523 B
Ruby
Raw Normal View History

2016-12-22 21:49:31 +01:00
class ApplicationJob < ActiveJob::Base
before_perform do |job|
2018-10-25 15:11:12 +02:00
Rails.logger.info("#{job.class.name} started at #{Time.zone.now}")
end
after_perform do |job|
2018-10-25 15:11:12 +02:00
Rails.logger.info("#{job.class.name} ended at #{Time.zone.now}")
end
rescue_from(ApiEntreprise::API::ResourceNotFound) do |exception|
error(self, exception)
end
rescue_from(ApiEntreprise::API::BadFormatRequest) do |exception|
error(self, exception)
end
def error(job, exception)
Raven.capture_exception(exception)
end
2016-12-22 21:49:31 +01:00
end