This commit is contained in:
Timothy Jaeryang Baek committed 2026-06-29 05:47:21 -05:00
1 parent ee5de69e37
commit 0883638027
7 files changed
+86 -43

No files matched your search

+16 -7
View File
@@ -22,7 +22,6 @@ from open_webui.models.models import Models
from open_webui.models.tools import Tools
from open_webui.models.users import UserInfoResponse, Users
from open_webui.utils.auth import get_admin_user, get_verified_user
from open_webui.utils.errors import error_detail
from sqlalchemy.ext.asyncio import AsyncSession
log = logging.getLogger(__name__)
@@ -84,11 +83,13 @@ async def create_new_group(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ERROR_MESSAGES.DEFAULT('Error creating group'),
)
except HTTPException:
raise
except Exception as e:
log.exception(f'Error creating a new group: {e}')
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=error_detail(e, 'Error creating group'),
detail=ERROR_MESSAGES.DEFAULT(e, 'Error creating group'),
)
@@ -167,7 +168,7 @@ async def get_users_in_group(id: str, user=Depends(get_admin_user), db: AsyncSes
log.exception(f'Error adding users to group {id}: {e}')
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=error_detail(e, 'Error getting group members'),
detail=ERROR_MESSAGES.DEFAULT(e, 'Error getting group members'),
)
@@ -203,11 +204,13 @@ async def update_group_by_id(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ERROR_MESSAGES.DEFAULT('Error updating group'),
)
except HTTPException:
raise
except Exception as e:
log.exception(f'Error updating group {id}: {e}')
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=error_detail(e, 'Error updating group'),
detail=ERROR_MESSAGES.DEFAULT(e, 'Error updating group'),
)
@@ -246,11 +249,13 @@ async def add_user_to_group(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ERROR_MESSAGES.DEFAULT('Error adding users to group'),
)
except HTTPException:
raise
except Exception as e:
log.exception(f'Error adding users to group {id}: {e}')
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=error_detail(e, 'Error adding users to group'),
detail=ERROR_MESSAGES.DEFAULT(e, 'Error adding users to group'),
)
@@ -281,11 +286,13 @@ async def remove_users_from_group(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ERROR_MESSAGES.DEFAULT('Error removing users from group'),
)
except HTTPException:
raise
except Exception as e:
log.exception(f'Error removing users from group {id}: {e}')
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=error_detail(e, 'Error removing users from group'),
detail=ERROR_MESSAGES.DEFAULT(e, 'Error removing users from group'),
)
@@ -313,11 +320,13 @@ async def delete_group_by_id(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ERROR_MESSAGES.DEFAULT('Error deleting group'),
)
except HTTPException:
raise
except Exception as e:
log.exception(f'Error deleting group {id}: {e}')
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=error_detail(e, 'Error deleting group'),
detail=ERROR_MESSAGES.DEFAULT(e, 'Error deleting group'),
)