From cdba9d2658a78c7ce3a3f778ebeef8c6ed5b76d9 Mon Sep 17 00:00:00 2001 From: Alexander Song Date: Fri, 15 Mar 2024 12:44:57 -0700 Subject: [PATCH] chore: raise exception when id passed to deleteProject and archiveProject mutations corresponds to a non-Project node --- src/phoenix/server/api/schema.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/phoenix/server/api/schema.py b/src/phoenix/server/api/schema.py index 22e13d93e4..a4f2ed3a6b 100644 --- a/src/phoenix/server/api/schema.py +++ b/src/phoenix/server/api/schema.py @@ -234,7 +234,10 @@ def delete_project(self, info: Info[Context, None], id: GlobalID) -> Query: return Query() type_name, node_id = from_global_id(str(id)) if type_name != "Project": - return Query() + raise ValueError( + "The id passed to deleteProject must correspond to a node of type Project, " + f"but was passed a node of type: {type_name}" + ) traces.archive_project(node_id) return Query() @@ -244,7 +247,10 @@ def archive_project(self, info: Info[Context, None], id: GlobalID) -> Query: return Query() type_name, node_id = from_global_id(str(id)) if type_name != "Project": - return Query() + raise ValueError( + "The id passed to archiveProject must correspond to a node of type Project, " + f"but was passed a node of type: {type_name}" + ) traces.archive_project(node_id) return Query()