// Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.
Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.
// Recovery returns a middleware that recovers from any panics and writes a 500 if there was one .
func Recovery() gin.HandlerFunc {
	return func(c *gin.Context) {
		defer func() {
			if err := recover(); err != nil {
				c.JSON(http.StatusInternalServerError, gin.H{"code": util.ERR, "msg": "server err awsl!", "data": err})
			}
		}()
		c.Next()
	}
}
func Recovery ( ) gin . HandlerFunc { return func ( c * gin . Context ) { defer func ( ) { if err := recover ( ) ; err != nil { c . JSON ( http . StatusInternalServerError , gin . H { " " : util . ERR , " " : " " , " " : err } ) } } ( ) c . Next ( ) } }
Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.
Recovery returns a middleware that recovers from any panics and writes a 500 if there was one .