Fix organization deletion error messages (#107380)
* Fix organization deletion error messages - Improve error message clarity when attempting to delete active organization - Fix incorrect 'Failed to update organization' message to 'Failed to delete organization' - Update comment to be more precise about the check being performed Fixes #92792 * Improve error handling in organization deletion service - Add contextual error message when dashboard deletion fails during org deletion - Include organization ID in error message for better debugging - Import fmt package for error formatting This helps administrators understand which specific organization failed during the deletion process when dashboard cleanup encounters issues. * Fix typo in unified resource access error message Change 'Namespace missmatch' to 'Namespace mismatch' for correct spelling.
This commit is contained in:
@@ -3,6 +3,7 @@ package orgimpl
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
@@ -59,7 +60,7 @@ func (s *DeletionService) Delete(ctx context.Context, cmd *org.DeleteOrgCommand)
|
||||
ctx, _ = identity.WithServiceIdentity(ctx, cmd.ID)
|
||||
err = s.dashSvc.DeleteAllDashboards(ctx, cmd.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to delete dashboards for org %d: %w", cmd.ID, err)
|
||||
}
|
||||
|
||||
return s.store.Delete(ctx, cmd)
|
||||
|
||||
Reference in New Issue
Block a user