http/middlewares.go
func RecoverHandlerJson(next http.Handler) http.Handler {
	fn := func(w http.ResponseWriter, r *http.Request) {
		defer func() {
			if err := recover(); err != nil {
				jerr := NewJsonErrorFromError(
					http.StatusInternalServerError, fmt.Errorf("panic: %+v", err))
				JsonWrite(w, jerr.Status, jerr)
			}
		}()

		next.ServeHTTP(w, r)
	}

	return http.HandlerFunc(fn)
}
func RecoverHandlerJson(next http.Handler) http.Handler {
	fn := func(w http.ResponseWriter, r *http.Request) {
		defer func() {
			if err := recover(); err != nil {
				jerr := NewJsonErrorFromError(
					http.StatusInternalServerError, fmt.Errorf("panic: %+v", err))
				JsonWrite(w, jerr.Status, jerr)
			}
		}()

		next.ServeHTTP(w, r)
	}

	return http.HandlerFunc(fn)
}
func RecoverHandlerJson ( next http . Handler ) http . Handler { fn := func ( w http . ResponseWriter , r * http . Request ) { defer func ( ) { if err := recover ( ) ; err != nil { jerr := NewJsonErrorFromError ( http . StatusInternalServerError , fmt . Errorf ( " " , err ) ) JsonWrite ( w , jerr . Status , jerr ) } } ( ) next . ServeHTTP ( w , r ) } return http . HandlerFunc ( fn ) }
// RecoverHandlerJson is a HTTP request middleware that captures panic errors
// and returns it as HTTP JSON response.
RecoverHandlerJson is a HTTP request middleware that captures panic errors and returns it as HTTP JSON response .