Folders: Add max depth check with descendant to /apis (#115305)
This commit is contained in:
@@ -29,7 +29,8 @@ func ToFolderErrorResponse(err error) response.Response {
|
||||
errors.Is(err, dashboards.ErrDashboardTypeMismatch) ||
|
||||
errors.Is(err, dashboards.ErrDashboardInvalidUid) ||
|
||||
errors.Is(err, dashboards.ErrDashboardUidTooLong) ||
|
||||
errors.Is(err, folder.ErrFolderCannotBeParentOfItself) {
|
||||
errors.Is(err, folder.ErrFolderCannotBeParentOfItself) ||
|
||||
errors.Is(err, folder.ErrMaximumDepthReached) {
|
||||
return response.Error(http.StatusBadRequest, err.Error(), nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func TestToFolderErrorResponse(t *testing.T) {
|
||||
{
|
||||
name: "maximum depth reached",
|
||||
input: folder.ErrMaximumDepthReached.Errorf("Maximum nested folder depth reached"),
|
||||
want: response.Err(folder.ErrMaximumDepthReached.Errorf("Maximum nested folder depth reached")),
|
||||
want: response.Error(http.StatusBadRequest, "[folder.maximum-depth-reached] Maximum nested folder depth reached", nil),
|
||||
},
|
||||
{
|
||||
name: "bad request errors",
|
||||
|
||||
Reference in New Issue
Block a user