Skip to content

Commit

Permalink
fix: Raise exception if multiple VFolders exist in decorator
Browse files Browse the repository at this point in the history
Add changelog

Add test code for decorator
  • Loading branch information
HyeockJinKim committed Jan 17, 2025
1 parent 482da3b commit 8fbf486
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions changes/3465.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Raise exception if multiple VFolders exist in decorator
15 changes: 7 additions & 8 deletions src/ai/backend/manager/api/vfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,13 @@ async def _wrapped(
*args: P.args,
**kwargs: P.kwargs,
) -> web.Response:
for row in folder_rows:
try:
await check_vfolder_status(row, status)
return await handler(request, row, *args, **kwargs)
except VFolderFilterStatusFailed:
pass
# none of our candidates matched the status filter, so we should instead raise error here
raise VFolderFilterStatusFailed
if len(folder_rows) > 1:
raise TooManyVFoldersFound(folder_rows)
if len(folder_rows) == 0:
raise VFolderNotFound()
row = folder_rows[0]
await check_vfolder_status(row, status)
return await handler(request, row, *args, **kwargs)

return _wrapped

Expand Down

0 comments on commit 8fbf486

Please sign in to comment.