[v9.5.x] Nested folders: Fix error response codes (#66975)

Nested folders: Fix error response codes (#66943)

* Nested folders: Fix error response codes

Fix error handling

(cherry picked from commit 24696d593b)

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-04-21 15:15:14 +00:00
committed by GitHub
co-authored by Sofia Papagiannaki
parent 6c0aeb452d
commit 8bc2a7144a
3 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -533,7 +533,7 @@ func (s *Service) Move(ctx context.Context, cmd *folder.MoveFolderCommand) (*fol
// current folder height + current folder + parent folder + parent folder depth should be less than or equal 8
if folderHeight+len(parents)+2 > folder.MaxNestedFolderDepth {
return nil, folder.ErrMaximumDepthReached
return nil, folder.ErrMaximumDepthReached.Errorf("failed to move folder")
}
// if the current folder is already a parent of newparent, we should return error
@@ -749,7 +749,7 @@ func (s *Service) validateParent(ctx context.Context, orgID int64, parentUID str
}
if len(ancestors) == folder.MaxNestedFolderDepth {
return folder.ErrMaximumDepthReached
return folder.ErrMaximumDepthReached.Errorf("failed to validate parent folder")
}
// Create folder under itself is not allowed