mirror of
https://github.com/grafana/grafana.git
synced 2026-08-18 17:15:08 -05:00
API: Fix snapshot responses (#52998)
* API: Fix response status when snapshots are not found * API: Fix response status when snapshot key is empty * Apply suggestions from code review
This commit is contained in:
@@ -91,7 +91,7 @@ func (d *DashboardSnapshotStore) GetDashboardSnapshot(ctx context.Context, query
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !has {
|
||||
return dashboardsnapshots.ErrDashboardSnapshotNotFound
|
||||
return dashboardsnapshots.ErrBaseNotFound.Errorf("dashboard snapshot not found")
|
||||
}
|
||||
|
||||
query.Result = &snapshot
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package dashboardsnapshots
|
||||
|
||||
import "github.com/grafana/grafana/pkg/services/dashboards"
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
)
|
||||
|
||||
var ErrDashboardSnapshotNotFound = dashboards.DashboardErr{
|
||||
Reason: "Dashboard snapshot not found",
|
||||
StatusCode: 404,
|
||||
}
|
||||
var ErrBaseNotFound = errutil.NewBase(errutil.StatusNotFound, "dashboardsnapshots.not-found", errutil.WithPublicMessage("Snapshot not found"))
|
||||
|
||||
Reference in New Issue
Block a user