From 56c2e57aee8cc3437412e2d36a704f0725600066 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 23 Feb 2022 11:31:41 +0100 Subject: [PATCH] controllers: fix crash on APIEntreprise::API::Error::ServiceUnavailable In that case we want to display the nicely formatted error message to the user, instead of a "Error 500" page. --- app/controllers/users/dossiers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 2b059e156..89a665419 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -106,7 +106,7 @@ module Users sanitized_siret = siret_model.siret begin etablissement = APIEntrepriseService.create_etablissement(@dossier, sanitized_siret, current_user.id) - rescue APIEntreprise::API::Error::RequestFailed, APIEntreprise::API::Error::BadGateway, APIEntreprise::API::Error::TimedOut + rescue APIEntreprise::API::Error::RequestFailed, APIEntreprise::API::Error::BadGateway, APIEntreprise::API::Error::TimedOut, APIEntreprise::API::Error::ServiceUnavailable return render_siret_error(t('errors.messages.siret_network_error')) end if etablissement.nil?