Skip to content

Commit f473a2b

Browse files
committed
⚡️ Add error raise for folder duplicate
Raises an exception if more than one folder is returned for a specific path
1 parent e08aee1 commit f473a2b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

simvue/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,18 @@ def _get_folder_id_from_path(self, path: str) -> str | None:
359359
_ids = Folder.ids(filters=json.dumps([f"path == {path}"]))
360360

361361
try:
362-
return next(_ids)
362+
_id = next(_ids)
363363
except StopIteration:
364364
return None
365365

366+
with contextlib.suppress(StopIteration):
367+
next(_ids)
368+
raise RuntimeError(
369+
f"Expected single folder match for '{path}', but found duplicate."
370+
)
371+
372+
return _id
373+
366374
@prettify_pydantic
367375
@pydantic.validate_call
368376
def delete_runs(

0 commit comments

Comments
 (0)