From 331d4954e16d3f9dc375ae55cd0845efe3f73349 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 27 Jun 2024 15:40:01 +0200 Subject: [PATCH 1/3] Decrease log level for requesting invalid items --- lib/galaxy/managers/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/managers/base.py b/lib/galaxy/managers/base.py index be487b4da675..6629e6911267 100644 --- a/lib/galaxy/managers/base.py +++ b/lib/galaxy/managers/base.py @@ -178,7 +178,7 @@ def get_object(trans, id, class_name, check_ownership=False, check_accessible=Fa item = trans.sa_session.query(item_class).get(decoded_id) assert item is not None except Exception: - log.exception(f"Invalid {class_name} id ( {id} ) specified.") + log.warning(f"Invalid {class_name} id ( {id} ) specified.") raise exceptions.MessageException(f"Invalid {class_name} id ( {id} ) specified", type="error") if check_ownership or check_accessible: From 7d57020e7dbf1c90e92a7353b48413f4f167623d Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 27 Jun 2024 15:40:24 +0200 Subject: [PATCH 2/3] Raise serializable exceptions when uploading broken workflows --- lib/galaxy/managers/workflows.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index 7f57f698e5f2..31bf22ac6d20 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -1856,10 +1856,14 @@ def __load_subworkflow_from_step_dict( embedded_subworkflow = step_dict.get("subworkflow", None) subworkflow_id = step_dict.get("content_id", None) if embedded_subworkflow and subworkflow_id: - raise Exception("Subworkflow step defines both subworkflow and content_id, only one may be specified.") + raise exceptions.RequestParameterInvalidException( + "Subworkflow step defines both subworkflow and content_id, only one may be specified." + ) if not embedded_subworkflow and not subworkflow_id: - raise Exception("Subworkflow step must define either subworkflow or content_id.") + raise exceptions.RequestParameterInvalidException( + "Subworkflow step must define either subworkflow or content_id." + ) if embedded_subworkflow: assert not dry_run From 983048805f1928ca83444b5ec95e2a797380eb26 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 27 Jun 2024 15:40:44 +0200 Subject: [PATCH 3/3] Raise serializable exception when loading invalid version for a workflow Fixes https://github.com/galaxyproject/galaxy/issues/18438 --- lib/galaxy/model/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index bdb543e146bb..e4bd56ace205 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -7666,7 +7666,7 @@ def get_internal_version(self, version): if version is None: return self.latest_workflow if len(self.workflows) <= version: - raise Exception("Version does not exist") + raise galaxy.exceptions.RequestParameterInvalidException("Version does not exist") return list(reversed(self.workflows))[version] def version_of(self, workflow):