fix(api-entreprise): do not crash when siret not found
This commit is contained in:
parent
6511836f2d
commit
d1d5bc2e67
2 changed files with 19 additions and 10 deletions
|
@ -6,7 +6,14 @@ class APIEntreprise::EntrepriseAdapter < APIEntreprise::Adapter
|
|||
end
|
||||
|
||||
def process_params
|
||||
params = data_source[:entreprise]&.slice(*attr_to_fetch)
|
||||
params = data_source[:entreprise]
|
||||
return {} if params.nil?
|
||||
|
||||
Sentry.with_scope do |scope|
|
||||
scope.set_tags(siret: @siret)
|
||||
scope.set_extras(source: params)
|
||||
|
||||
params = params.slice(*attr_to_fetch)
|
||||
params[:etat_administratif] = map_etat_administratif(data_source)
|
||||
|
||||
if params.present? && valid_params?(params)
|
||||
|
@ -19,6 +26,7 @@ class APIEntreprise::EntrepriseAdapter < APIEntreprise::Adapter
|
|||
{}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def attr_to_fetch
|
||||
[
|
||||
|
|
|
@ -15,12 +15,13 @@ class APIEntreprise::RNAAdapter < APIEntreprise::Adapter
|
|||
|
||||
def process_params
|
||||
params = data_source[:association]
|
||||
return {} if params.nil?
|
||||
|
||||
Sentry.with_scope do |scope|
|
||||
scope.set_tags(siret: @siret)
|
||||
scope.set_extras(source: params)
|
||||
|
||||
params = params&.slice(*attr_to_fetch) if @depreciated
|
||||
params = params.slice(*attr_to_fetch) if @depreciated
|
||||
params[:rna] = data_source.dig(:association, :id)
|
||||
|
||||
if params[:rna].present? && valid_params?(params)
|
||||
|
|
Loading…
Reference in a new issue