Projet

Général

Profil

Bug #49304

Toulouse Axel: 'SOAPError' object has no attribute 'err_code'

Ajouté par Lauréline Guérin il y a plus de 3 ans. Mis à jour il y a plus de 3 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
10 décembre 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

HTTPError: 504 Server Error: Gateway Time-out for url: https://passerelle.eservices.toulouse-metropole.fr/pfs/Axel_WS/AxelWS.php?wsdl
  File "passerelle/utils/soap.py", line 60, in _load_remote_data
    return super(SOAPTransport, self)._load_remote_data(url)
  File "zeep/transports.py", line 127, in _load_remote_data
    response.raise_for_status()
  File "requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)

SOAPError: SOAP service is down, location 'https://passerelle.eservices.toulouse-metropole.fr/pfs/Axel_WS/AxelWS.php?wsdl' cannot be loaded: 504 Server Error: Gateway Time-out for url: https://passerelle.eservices.toulouse-metropole.fr/pfs/Axel_WS/AxelWS.php?wsdl
  File "passerelle/contrib/toulouse_axel/models.py", line 174, in link
    result = self.check_dui(post_data)
  File "passerelle/contrib/toulouse_axel/models.py", line 138, in check_dui
    result = schemas.ref_verif_dui(self, {'PORTAIL': {'DUI': post_data}})
  File "passerelle/contrib/toulouse_axel/schemas.py", line 127, in __call__
    client = resource.soap_client()
  File "passerelle/base/models.py", line 231, in soap_client
    return passerelle.utils.soap.SOAPClient(resource=self, **kwargs)
  File "passerelle/utils/soap.py", line 41, in __init__
    super(SOAPClient, self).__init__(wsdl_url, transport=transport, **kwargs)
  File "zeep/client.py", line 62, in __init__
    wsdl, self.transport, settings=self.settings)
  File "zeep/wsdl/wsdl.py", line 82, in __init__
    document = self._get_xml_document(location)
  File "zeep/wsdl/wsdl.py", line 143, in _get_xml_document
    location, self.transport, self.location, settings=self.settings)
  File "zeep/loader.py", line 74, in load_external
    content = transport.load(url)
  File "zeep/transports.py", line 110, in load
    content = self._load_remote_data(url)
  File "passerelle/utils/soap.py", line 62, in _load_remote_data
    raise SOAPError('SOAP service is down, location %r cannot be loaded: %s' % (url, e), exception=e, url=url)

AttributeError: 'SOAPError' object has no attribute 'err_code'
  File "passerelle/utils/jsonresponse.py", line 128, in api
    resp = f(*args, **kwargs)
  File "passerelle/views.py", line 481, in perform
    result = self.endpoint(request, **params)
  File "passerelle/contrib/toulouse_axel/models.py", line 176, in link
    if e.err_code == 'error':

https://sentry.entrouvert.org/entrouvert/nfrance/issues/10779/


Fichiers

Révisions associées

Révision bbe4f816 (diff)
Ajouté par Lauréline Guérin il y a plus de 3 ans

toulouse-axel: fix link endpoint when SOAPError is raised (#49304)

Historique

#1

Mis à jour par Lauréline Guérin il y a plus de 3 ans

#2

Mis à jour par Thomas Noël il y a plus de 3 ans

Marrant ça, qu'on ait rien vu avant.

Je me demande dans quelle mesure ça serait pas préférable de raiser quand l'APIError reçue n'a pas de err_code (et vient donc d'une couche "plus basse" telle que SOAPError dans le cas présent) ?

Genre :

        ...
        try:
            result = self.check_dui(post_data)
        except APIError as e:
            if not hasattr(e, 'err_code') or e.err_code == 'error':     <-- on raise s'il n'y a pas de APIError.err_code (la célèbre "erreur inattendue") :
                raise
            raise APIError('Person not found', err_code='not-found')
#4

Mis à jour par Thomas Noël il y a plus de 3 ans

  • Statut changé de Solution proposée à Solution validée

Zou, pushit maintenant (y'a un tag passerelle qui arrive dans les minutes à venir)

#5

Mis à jour par Lauréline Guérin il y a plus de 3 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit bbe4f81630d6459ff577c098920980d2bd3cdf21
Author: Lauréline Guérin <zebuline@entrouvert.com>
Date:   Thu Dec 10 11:07:34 2020 +0100

    toulouse-axel: fix link endpoint when SOAPError is raised (#49304
#6

Mis à jour par Frédéric Péters il y a plus de 3 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF