These are chat archives for gin-gonic/gin

21st
Jan 2016
Alix Axel
@alixaxel
Jan 21 2016 17:58
Can anyone tell me if there's a way to "short-circuit" responses, i.e.: whenever an error occurs without having to explicitly do return afterwards?
Like, this wouldn't work:
router.GET("/ping", func(c *gin.Context) {
    stuff := new(Stuff)

    if err := stuff.Save(); err != nil {
        c.JSON(http.StatusInternalServerError, err)
    }

    c.JSON(http.StatusCreated, stuff)
})
Craig Peterson
@captncraig
Jan 21 2016 19:50
Nope, you gotta add the return