mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
6c5a573772
* Chore: Move ReqContext to contexthandler service * Rename package to contextmodel * Generate ngalert files * Remove unused imports
22 lines
495 B
Go
22 lines
495 B
Go
package routing
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/api/response"
|
|
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
|
"github.com/grafana/grafana/pkg/web"
|
|
)
|
|
|
|
var (
|
|
ServerError = func(err error) response.Response {
|
|
return response.Error(500, "Server error", err)
|
|
}
|
|
)
|
|
|
|
func Wrap(handler func(c *contextmodel.ReqContext) response.Response) web.Handler {
|
|
return func(c *contextmodel.ReqContext) {
|
|
if res := handler(c); res != nil {
|
|
res.WriteTo(c)
|
|
}
|
|
}
|
|
}
|