Skip to content

Commit

Permalink
fix: return empty list if project not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradip-p committed Sep 27, 2024
1 parent d697240 commit ea845eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def custom_404_handler(request: Request, _):
if format == "json" or not is_browser:
return JSONResponse(status_code=404, content={"detail": "Not found"})
return frontend_html.TemplateResponse(
name="index.html", context={"request": request}, status_code=404
name="index.html", context={"request": request}
)

except Exception:
Expand Down
6 changes: 2 additions & 4 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,11 @@ async def read_projects(
db, user_id=user_id, skip=skip, limit=limit
)
if not projects:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="No projects found."
)
return []

return projects
except KeyError as e:
raise HTTPException(status_code=HTTPStatus.NOT_FOUND) from e
raise HTTPException(status_code=HTTPStatus.UNPROCESSABLE_ENTITY) from e


@router.get(
Expand Down

0 comments on commit ea845eb

Please sign in to comment.