Last active
July 2, 2018 20:52
-
-
Save Cibernomadas/7d953675f7d2cc8417ff75645d88a7cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func RegisterRecovery() gin.HandlerFunc { | |
return func(c *gin.Context) { | |
defer func() { | |
if err := recover(); err != nil { | |
// Do recover things | |
c.AbortWithStatus(http.StatusInternalServerError) | |
} | |
}() | |
c.Next() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment