Merge pull request #6984 from betagouv/fix-api-entreprise-error

Affichage d'un message clair en cas d'erreur `APIEntreprise::API::Error::ServiceUnavailable`
This commit is contained in:
Pierre de La Morinerie 2022-02-23 14:58:02 +01:00 committed by GitHub
commit c6425cd1a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -17,7 +17,7 @@ class Champs::SiretController < ApplicationController
begin
etablissement = find_etablissement_with_siret
rescue APIEntreprise::API::Error::RequestFailed, APIEntreprise::API::Error::ServiceUnavailable
rescue APIEntreprise::API::Error::RequestFailed, APIEntreprise::API::Error::BadGateway, APIEntreprise::API::Error::TimedOut, APIEntreprise::API::Error::ServiceUnavailable
# i18n-tasks-use t('errors.messages.siret_network_error')
return siret_error(:network_error)
end

View file

@ -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?