<commit_before>package middleware

import (
	"net/http"

	nextSkyerr "github.com/skygeario/skygear-server/pkg/core/skyerr"
	"github.com/skygeario/skygear-server/pkg/server/skyerr"
)

// RecoverHandler provides an interface to handle recovered panic error
type RecoverHandler func(http.ResponseWriter, *http.Request, skyerr.Error)

// RecoverMiddleware recover from panic
type RecoverMiddleware struct {
	RecoverHandler RecoverHandler
}

func (m RecoverMiddleware) Handle(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		defer func() {
			if rec := recover(); r != nil {
				err := nextSkyerr.ErrorFromRecoveringPanic(rec)
				if m.RecoverHandler != nil {
					m.RecoverHandler(w, r, err)
				}
			}
		}()

		next.ServeHTTP(w, r)
	})
}
<commit_msg>Fix wrong variable name in RecoverMiddleware<commit_after>package middleware

import (
	"net/http"

	nextSkyerr "github.com/skygeario/skygear-server/pkg/core/skyerr"
	"github.com/skygeario/skygear-server/pkg/server/skyerr"
)

// RecoverHandler provides an interface to handle recovered panic error
type RecoverHandler func(http.ResponseWriter, *http.Request, skyerr.Error)

// RecoverMiddleware recover from panic
type RecoverMiddleware struct {
	RecoverHandler RecoverHandler
}

func (m RecoverMiddleware) Handle(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		defer func() {
			if rec := recover(); rec != nil {
				err := nextSkyerr.ErrorFromRecoveringPanic(rec)
				if m.RecoverHandler != nil {
					m.RecoverHandler(w, r, err)
				}
			}
		}()

		next.ServeHTTP(w, r)
	})
}

{'fraction_non_alphanumeric': 0.11306990881458967, 'fraction_numerical': 0.0, 'mean_word_length': 4.379084967320262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5300202', 'n_tokens_mistral': 592, 'n_tokens_neox': 550, 'n_words': 121}