Projet

Général

Profil

Development #39273

AttributeError: 'list' object has no attribute 'get'

Ajouté par Sentry Io il y a environ 4 ans. Mis à jour il y a environ 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
27 janvier 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

https://sentry.entrouvert.org/entrouvert/publik/issues/444/

AttributeError: 'list' object has no attribute 'get'
  File "passerelle/utils/jsonresponse.py", line 128, in api
    resp = f(*args, **kwargs)
  File "passerelle/apps/clicrdv/views.py", line 24, in get
    return {'data': self.get_object().get_datetimes(intervention_id)}
  File "passerelle/apps/clicrdv/models.py", line 103, in get_datetimes
    for timeslot in self.get_available_timeslots(intervention):
  File "passerelle/apps/clicrdv/models.py", line 96, in get_available_timeslots
    for timeslot in self.request(request_uri).json().get('availabletimeslots'):

Error occurred while processing request

Fichiers

Révisions associées

Révision 30132e25 (diff)
Ajouté par Valentin Deniaud il y a environ 4 ans

clicrdv: improve API error handling (#39273)

Historique

#1

Mis à jour par Lauréline Guérin il y a environ 4 ans

  • Projet changé de Suivi des traces à Passerelle
#2

Mis à jour par Valentin Deniaud il y a environ 4 ans

  • Assigné à mis à Valentin Deniaud

Retour de l'API à cet appel : [{u'error': u'The intervention_ids parameter contains at least one invalid id'}]
Ce n'est donc pas un changement dans le format attendu par l'endpoint comme on en a eu récemment dans #39248. Mais peut-être que l'id invalide qui s'est retrouvé là en est quand même une conséquence, je vais regarder plus en détail, et rajouter la gestion d'erreurs quoiqu'il en soit.

#3

Mis à jour par Valentin Deniaud il y a environ 4 ans

J'ai donc refait la gestion d'erreurs. Elle était plutôt foireuse, du genre la ligne error = json.loads(str(e))[0].get('error') marchait surtout dans les tests et pas dans la vraie vie.

#4

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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

Mis à jour par Valentin Deniaud il y a environ 4 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 30132e2578e4f943019d53190941e449a53cfc40
Author: Valentin Deniaud <vdeniaud@entrouvert.com>
Date:   Tue Jan 28 18:16:03 2020 +0100

    clicrdv: improve API error handling (#39273)
#6

Mis à jour par Frédéric Péters il y a environ 4 ans

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

Formats disponibles : Atom PDF