fix(sentry/rna): add error context when RNA schema failed
This commit is contained in:
parent
820cb4bd27
commit
e63e4fc975
1 changed files with 16 additions and 8 deletions
|
@ -15,15 +15,23 @@ class APIEntreprise::RNAAdapter < APIEntreprise::Adapter
|
||||||
|
|
||||||
def process_params
|
def process_params
|
||||||
params = data_source[:association]
|
params = data_source[:association]
|
||||||
params = params&.slice(*attr_to_fetch) if @depreciated
|
|
||||||
params[:rna] = data_source.dig(:association, :id)
|
|
||||||
if params[:rna].present? && valid_params?(params)
|
|
||||||
params = params.transform_keys { |k| :"association_#{k}" }.deep_stringify_keys
|
|
||||||
raise InvalidSchemaError.new(schemer.validate(params).to_a) unless schemer.valid?(params)
|
|
||||||
|
|
||||||
params
|
Sentry.with_scope do |scope|
|
||||||
else
|
scope.set_tags(siret: @siret)
|
||||||
{}
|
scope.set_extras(source: params)
|
||||||
|
|
||||||
|
params = params&.slice(*attr_to_fetch) if @depreciated
|
||||||
|
params[:rna] = data_source.dig(:association, :id)
|
||||||
|
|
||||||
|
if params[:rna].present? && valid_params?(params)
|
||||||
|
params = params.transform_keys { |k| :"association_#{k}" }.deep_stringify_keys
|
||||||
|
|
||||||
|
raise InvalidSchemaError.new(schemer.validate(params).to_a) unless schemer.valid?(params)
|
||||||
|
|
||||||
|
params
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue