errors/middleware.go
func SetErrorHandler(status int, handler ErrorHandler) scaffold.Middleware {
	return scaffold.Middleware(func(next scaffold.Handler) scaffold.Handler {
		return scaffold.HandlerFunc(func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
			key := fmt.Sprintf("error_handler_%d", status)
			ctx = context.WithValue(ctx, key, handler)

			next.CtxServeHTTP(ctx, w, r)
		})
	})
}
func SetErrorHandler(status int, handler ErrorHandler) scaffold.Middleware {
	return scaffold.Middleware(func(next scaffold.Handler) scaffold.Handler {
		return scaffold.HandlerFunc(func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
			key := fmt.Sprintf("error_handler_%d", status)
			ctx = context.WithValue(ctx, key, handler)

			next.CtxServeHTTP(ctx, w, r)
		})
	})
}
// SetErrorHandler returns Middleware that can be used to set the error handler