Merge pull request #5261 from betagouv/no-sentry-report

no sentry report when error 400 for exercices
This commit is contained in:
krichtof 2020-06-12 20:20:33 +02:00 committed by GitHub
commit ce89a138bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View file

@ -1,4 +1,7 @@
class ApiEntreprise::ExercicesJob < ApiEntreprise::Job
rescue_from(ApiEntreprise::API::BadFormatRequest) do |exception|
end
def perform(etablissement_id, procedure_id)
etablissement = Etablissement.find(etablissement_id)
etablissement_params = ApiEntreprise::ExercicesAdapter.new(etablissement.siret, procedure_id).to_params

View file

@ -1,5 +1,14 @@
class ApiEntreprise::Job < ApplicationJob
DEFAULT_MAX_ATTEMPTS_API_ENTREPRISE_JOBS = 5
rescue_from(ApiEntreprise::API::ResourceNotFound) do |exception|
error(self, exception)
end
rescue_from(ApiEntreprise::API::BadFormatRequest) do |exception|
error(self, exception)
end
def max_attempts
ENV[MAX_ATTEMPTS_API_ENTREPRISE_JOBS].to_i || DEFAULT_MAX_ATTEMPTS_API_ENTREPRISE_JOBS
end

View file

@ -9,14 +9,6 @@ class ApplicationJob < ActiveJob::Base
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