Chore: Use x/xerrors instead of pkg/errors (#16668)
* Use xerrors instead of pkg/errors * Add Wrap util func * Move Wrap to errutil package
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/guardian"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
)
|
||||
|
||||
// DashboardService service for operating on dashboards
|
||||
@@ -261,7 +261,7 @@ func (dr *dashboardServiceImpl) deleteDashboard(dashboardId int64, orgId int64,
|
||||
isDashboardProvisioned := &models.IsDashboardProvisionedQuery{DashboardId: dashboardId}
|
||||
err := bus.Dispatch(isDashboardProvisioned)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error while checking if dashboard is provisioned")
|
||||
return errutil.Wrap("failed to check if dashboard is provisioned", err)
|
||||
}
|
||||
|
||||
if isDashboardProvisioned.Result {
|
||||
|
||||
@@ -6,9 +6,8 @@ import (
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/guardian"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
func TestDashboardService(t *testing.T) {
|
||||
@@ -116,7 +115,7 @@ func TestDashboardService(t *testing.T) {
|
||||
})
|
||||
|
||||
bus.AddHandler("test", func(cmd *models.ValidateDashboardAlertsCommand) error {
|
||||
return errors.New("Alert validation error")
|
||||
return xerrors.New("Alert validation error")
|
||||
})
|
||||
|
||||
dto.Dashboard = models.NewDashboard("Dash")
|
||||
|
||||
Reference in New Issue
Block a user