Commit 3a8854b1 by Arve Knudsen Committed by GitHub

API: Recognize dashboard errors when saving a folder (#26499)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
parent 4c56eb39
package api
import (
"errors"
"fmt"
"github.com/grafana/grafana/pkg/api/dtos"
......@@ -127,6 +128,11 @@ func toFolderDto(g guardian.DashboardGuardian, folder *models.Folder) dtos.Folde
}
func toFolderError(err error) Response {
var dashboardErr models.DashboardErr
if ok := errors.As(err, &dashboardErr); ok {
return Error(dashboardErr.StatusCode, err.Error(), err)
}
if err == models.ErrFolderTitleEmpty ||
err == models.ErrFolderSameNameExists ||
err == models.ErrFolderWithSameUIDExists ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment