TEA: un KeyError interno de la figura no se vuelve 404

KeyError es subclase de LookupError. El except LookupError de la ruta
convertía cualquier error interno del kit en un 404 con su mensaje. Ahora
solo un periodo sin reporte da 404; lo demás es un error del servidor.
This commit is contained in:
2026-10-09 02:23:34 +00:00
parent 0355d21d47
commit ceca8a03b5
2 changed files with 14 additions and 0 deletions
+3
View File
@@ -82,6 +82,9 @@ def get_figura(indicador: str, figura: str):
if not periodos:
return _error("el indicador no tiene reportes calculados", 404)
texto = figura_json_tea(sesion, medida, periodos, figura, tablas=TABLAS, tema=tema)
except KeyError:
# KeyError también es LookupError: aquí es un error interno (500), no un periodo sin reporte.
raise
except LookupError as error:
return _error(str(error), 404)
finally: