From 46aa4c02019c25441d3788599d422daae43ba18b Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 19 Jul 2024 12:00:19 +0200 Subject: [PATCH] Raise appropriate exception if ldda not found Fixes https://sentry.galaxyproject.org/share/issue/db137d5e4eae40eea9b0fe85ffac4b19/: ``` AssertionError: null File "galaxy/web/framework/decorators.py", line 346, in decorator rval = func(self, trans, *args, **kwargs) File "galaxy/webapps/galaxy/api/tools.py", line 593, in create return self.service._create(trans, payload, **kwd) File "galaxy/webapps/galaxy/services/tools.py", line 155, in _create self._patch_library_inputs(trans, inputs, target_history) File "galaxy/webapps/galaxy/services/tools.py", line 276, in _patch_library_inputs patched = self._patch_library_dataset(trans, value, target_history) File "galaxy/webapps/galaxy/services/tools.py", line 284, in _patch_library_dataset assert ldda ``` --- lib/galaxy/webapps/galaxy/services/tools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/services/tools.py b/lib/galaxy/webapps/galaxy/services/tools.py index 1af3f95aba6e..9e2298eae134 100644 --- a/lib/galaxy/webapps/galaxy/services/tools.py +++ b/lib/galaxy/webapps/galaxy/services/tools.py @@ -281,7 +281,8 @@ def _patch_library_inputs(self, trans: ProvidesHistoryContext, inputs, target_hi def _patch_library_dataset(self, trans: ProvidesHistoryContext, v, target_history): if isinstance(v, dict) and "id" in v and v.get("src") == "ldda": ldda = trans.sa_session.get(LibraryDatasetDatasetAssociation, self.decode_id(v["id"])) - assert ldda + if not ldda: + raise exceptions.ObjectNotFound("Could not find library dataset dataset association.") if trans.user_is_admin or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset ):