mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Check errors from Close calls (#29562)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -15,7 +15,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/components/dashdiffs"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/services/guardian"
|
||||
@@ -334,7 +333,7 @@ func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) Response {
|
||||
dashRedirect := dtos.DashboardRedirect{RedirectUri: url}
|
||||
return JSON(200, &dashRedirect)
|
||||
}
|
||||
log.Warnf("Failed to get slug from database, %s", err.Error())
|
||||
hs.log.Warn("Failed to get slug from database", "err", err)
|
||||
}
|
||||
|
||||
filePath := hs.Cfg.DefaultHomeDashboardPath
|
||||
@@ -346,7 +345,11 @@ func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) Response {
|
||||
if err != nil {
|
||||
return Error(500, "Failed to load home dashboard", err)
|
||||
}
|
||||
defer file.Close()
|
||||
defer func() {
|
||||
if err := file.Close(); err != nil {
|
||||
hs.log.Warn("Failed to close dashboard file", "path", filePath, "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
dash := dtos.DashboardFullWithMeta{}
|
||||
dash.Meta.IsHome = true
|
||||
|
||||
Reference in New Issue
Block a user