chore/backend: move dashboard errors to dashboard service (#51593)

* chore/backend: move dashboard errors to dashboard service

Dashboard-related models are slowly moving out of the models package and into dashboard services. This commit moves dashboard-related errors; the rest will come in later commits.

There are no logical code changes, this is only a structural (package) move.

* lint lint lint
This commit is contained in:
Kristin Laemmert
2022-06-30 09:31:54 -04:00
committed by GitHub
parent a1fb73c503
commit 9de00c8eb2
46 changed files with 489 additions and 466 deletions
@@ -8,6 +8,7 @@ import (
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/user"
)
@@ -492,12 +493,12 @@ func TestIntegrationDashboardFolderDataAccess(t *testing.T) {
t.Run("should not find dashboard", func(t *testing.T) {
d, err := dashboardStore.GetFolderByUID(context.Background(), orgId, dash.Uid)
require.Nil(t, d)
require.ErrorIs(t, err, models.ErrFolderNotFound)
require.ErrorIs(t, err, dashboards.ErrFolderNotFound)
})
t.Run("should search in organization", func(t *testing.T) {
d, err := dashboardStore.GetFolderByUID(context.Background(), orgId+1, folder.Uid)
require.Nil(t, d)
require.ErrorIs(t, err, models.ErrFolderNotFound)
require.ErrorIs(t, err, dashboards.ErrFolderNotFound)
})
})
@@ -516,12 +517,12 @@ func TestIntegrationDashboardFolderDataAccess(t *testing.T) {
t.Run("should not find dashboard", func(t *testing.T) {
d, err := dashboardStore.GetFolderByID(context.Background(), orgId, dash.Id)
require.Nil(t, d)
require.ErrorIs(t, err, models.ErrFolderNotFound)
require.ErrorIs(t, err, dashboards.ErrFolderNotFound)
})
t.Run("should search in organization", func(t *testing.T) {
d, err := dashboardStore.GetFolderByID(context.Background(), orgId+1, folder.Id)
require.Nil(t, d)
require.ErrorIs(t, err, models.ErrFolderNotFound)
require.ErrorIs(t, err, dashboards.ErrFolderNotFound)
})
})
})