Skip to content

Commit e34f80a

Browse files
committed
use exceptions instead of bare return
1 parent 8af07f1 commit e34f80a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

api/v1/projects/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ async def return_project_by_id(
210210

211211
project = project_raw.scalar_one_or_none()
212212
if project is None:
213-
return Response(status_code=404)
213+
raise HTTPException(status_code=404, detail="Project not found")
214214

215215
return ProjectResponse.from_model(project)
216216

@@ -235,7 +235,7 @@ async def link_hackatime_project(
235235

236236
project = project_raw.scalar_one_or_none()
237237
if project is None:
238-
return Response(status_code=404)
238+
raise HTTPException(status_code=404, detail="Project not found")
239239

240240
if hackatime_project.name in project.hackatime_projects:
241241
raise HTTPException(
@@ -324,7 +324,7 @@ async def unlink_hackatime_project(
324324

325325
project = project_raw.scalar_one_or_none()
326326
if project is None:
327-
return Response(status_code=404)
327+
raise HTTPException(status_code=404, detail="Project not found")
328328

329329
if hackatime_project.name not in project.hackatime_projects:
330330
raise HTTPException(

0 commit comments

Comments
 (0)