Skip to content

Commit aa45976

Browse files
fix: return 404 when no games found for year
1 parent 793306c commit aa45976

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/handlers/handlers.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ func (h *Handler) GetGamesByYearHandler(c *gin.Context) {
8181
return
8282
}
8383

84+
if len(games) == 0 {
85+
c.JSON(http.StatusNotFound, gin.H{"message": "No games found for the given year"})
86+
return
87+
}
88+
8489
c.JSON(http.StatusOK, games)
8590
}
8691

0 commit comments

Comments
 (0)