Skip to content

Instantly share code, notes, and snippets.

@Cibernomadas
Last active July 2, 2018 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cibernomadas/7d953675f7d2cc8417ff75645d88a7cc to your computer and use it in GitHub Desktop.
Save Cibernomadas/7d953675f7d2cc8417ff75645d88a7cc to your computer and use it in GitHub Desktop.
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