Merge pull request #5261 from betagouv/no-sentry-report
no sentry report when error 400 for exercices
This commit is contained in:
commit
ce89a138bb
3 changed files with 12 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue