chore: avoid aliasing models in middleware (#22484)

This commit is contained in:
Carl Bergquist
2020-02-28 12:50:58 +01:00
committed by GitHub
parent 8b9b67f248
commit f2f2722bb1
15 changed files with 74 additions and 74 deletions

View File

@ -25,7 +25,7 @@ import (
"gopkg.in/macaron.v1"
"github.com/grafana/grafana/pkg/infra/log"
m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
)
@ -106,7 +106,7 @@ func Recovery() macaron.Handler {
panicLogger := log.Root
// try to get request logger
if ctx, ok := c.Data["ctx"]; ok {
ctxTyped := ctx.(*m.ReqContext)
ctxTyped := ctx.(*models.ReqContext)
panicLogger = ctxTyped.Logger
}
@ -138,7 +138,7 @@ func Recovery() macaron.Handler {
c.Data["ErrorMsg"] = string(stack)
}
ctx, ok := c.Data["ctx"].(*m.ReqContext)
ctx, ok := c.Data["ctx"].(*models.ReqContext)
if ok && ctx.IsApiRequest() {
resp := make(map[string]interface{})