Merge pull request #1544 from betagouv/log_siret_behaviour

Log siret behaviour to investigate Sentry #2371
This commit is contained in:
Mathieu Magnin 2018-03-05 18:07:39 +01:00 committed by GitHub
commit 1de1de7f1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,13 +106,16 @@ class Users::DossiersController < UsersController
update_current_user_siret!(siret)
etablissement_attributes = SIRETService.fetch(siret, @facade.dossier)
Rails.logger.info("etablissement_attributes for siret: #{siret}, present?: #{etablissement_attributes.present?}")
if etablissement_attributes.present?
etablissement_attributes = ActionController::Parameters.new(etablissement_attributes).permit!
etablissement = @facade.dossier.create_etablissement(etablissement_attributes)
if etablissement.save
Rails.logger.info("etablissement saved, siret: #{siret}, id: #{etablissement.id}")
@facade.dossier.mandataire_social!(current_user.france_connect_information)
else
Rails.logger.info("etablissement not saved, siret: #{siret}, errors: #{etablissement.errors.full_messages}")
return errors_valid_siret
end
else