mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(team_endpoints.py): consistently return 404 if team not found in DB
Fixes response on /team/delete
This commit is contained in:
parent
d415738860
commit
edf7eb867d
1 changed files with 5 additions and 3 deletions
|
@ -470,7 +470,7 @@ async def update_team(
|
||||||
|
|
||||||
if existing_team_row is None:
|
if existing_team_row is None:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=404,
|
||||||
detail={"error": f"Team not found, passed team_id={data.team_id}"},
|
detail={"error": f"Team not found, passed team_id={data.team_id}"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1137,14 +1137,16 @@ async def delete_team(
|
||||||
team_rows: List[LiteLLM_TeamTable] = []
|
team_rows: List[LiteLLM_TeamTable] = []
|
||||||
for team_id in data.team_ids:
|
for team_id in data.team_ids:
|
||||||
try:
|
try:
|
||||||
team_row_base: BaseModel = (
|
team_row_base: Optional[BaseModel] = (
|
||||||
await prisma_client.db.litellm_teamtable.find_unique(
|
await prisma_client.db.litellm_teamtable.find_unique(
|
||||||
where={"team_id": team_id}
|
where={"team_id": team_id}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if team_row_base is None:
|
||||||
|
raise Exception
|
||||||
except Exception:
|
except Exception:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=404,
|
||||||
detail={"error": f"Team not found, passed team_id={team_id}"},
|
detail={"error": f"Team not found, passed team_id={team_id}"},
|
||||||
)
|
)
|
||||||
team_row_pydantic = LiteLLM_TeamTable(**team_row_base.model_dump())
|
team_row_pydantic = LiteLLM_TeamTable(**team_row_base.model_dump())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue