Skip to content

Commit

Permalink
fix list events
Browse files Browse the repository at this point in the history
  • Loading branch information
colin014 committed Apr 2, 2018
1 parent 8c8534e commit 6291e74
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/games.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,14 @@ func ListEvents(c *gin.Context) {

log.Infof("Start listing events by gameId: %d", gameId)

if events, err := model.GetAllEvents(uint(gameId)); err != nil {
if _, err := model.GetGame(uint(gameId)); err != nil {
log.Errorf("Error during getting game: %s", err.Error())
c.JSON(http.StatusNotFound, model.ErrorResponse{
Code: http.StatusNotFound,
Message: "Error during getting game",
Error: err.Error(),
})
} else if events, err := model.GetAllEvents(uint(gameId)); err != nil {
log.Errorf("Error during listing events: %s", err.Error())
c.JSON(http.StatusBadRequest, model.ErrorResponse{
Code: http.StatusBadRequest,
Expand Down

0 comments on commit 6291e74

Please sign in to comment.