From 123af7067c3cbf64253c7df514f2f748dac5342a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 13 Sep 2022 10:50:13 +0200 Subject: [PATCH] modif exceptions --- app/scodoc/sco_archives.py | 2 +- app/scodoc/sco_edit_module.py | 2 +- app/scodoc/sco_groups.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index 3d400f2e08..4fd49b41c8 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -203,7 +203,7 @@ class BaseArchiver(object): log( f"invalid archive name: {archive_name}, oid={oid}, archive_id={archive_id}" ) - raise ValueError("invalid archive name") + raise ScoValueError(f"Archive {archive_name} introuvable") return archive_id def get_archive_description(self, archive_id): diff --git a/app/scodoc/sco_edit_module.py b/app/scodoc/sco_edit_module.py index e88e8c8aaf..15d44004bf 100644 --- a/app/scodoc/sco_edit_module.py +++ b/app/scodoc/sco_edit_module.py @@ -103,7 +103,7 @@ def do_module_create(args) -> int: if formation.is_apc(): ue = UniteEns.query.get(args["ue_id"]) if int(args.get("semestre_id", 0)) != ue.semestre_idx: - raise ValueError("Formation incompatible: contacter le support ScoDoc") + raise ScoValueError("Formation incompatible: contacter le support ScoDoc") # create cnx = ndb.GetDBConnexion() module_id = _moduleEditor.create(cnx, args) diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index c9416d2c42..b214310967 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -105,7 +105,7 @@ def get_group(group_id: int) -> dict: {"group_id": group_id}, ) if not r: - raise ValueError("invalid group_id (%s)" % group_id) + raise ScoValueError(f"Groupe inexistant ! (id {group_id})") return r[0]