Skip to content

Commit

Permalink
Error check when create post
Browse files Browse the repository at this point in the history
  • Loading branch information
vinhut committed Jul 7, 2020
1 parent a0b821a commit c941b32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ func setupRouter(postdb models.PostDatabase, authservice services.AuthService) *
Tag: make([]string, 1),
}

postdb.Create(new_post)
_, create_error := postdb.Create(new_post)
if create_error == nil {
c.String(200, "ok")
} else {
c.String(503, "error")
panic("failed create post")
}

})

Expand Down

0 comments on commit c941b32

Please sign in to comment.