diff --git a/vendor/magento/module-company-graph-ql/Model/Resolver/DeleteCompanyTeam.php b/vendor/magento/module-company-graph-ql/Model/Resolver/DeleteCompanyTeam.php index de51e6e5ab5c..a8e16a827765 100644 --- a/vendor/magento/module-company-graph-ql/Model/Resolver/DeleteCompanyTeam.php +++ b/vendor/magento/module-company-graph-ql/Model/Resolver/DeleteCompanyTeam.php @@ -13,6 +13,7 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; +use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Query\Uid; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; @@ -82,9 +83,14 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value try { $team = $this->teamRepository->get($teamId); $this->teamRepository->delete($team); - } catch (\Exception $e) { - throw new LocalizedException( - __('Can not delete team with id "%1"', $args['id']), + } catch (LocalizedException $e) { + throw new GraphQlInputException( + __( + 'Can not delete team with id "%1".' + . ' This team has child users or teams aligned to it and cannot be deleted.' + . ' Please re-align the child users or teams first.', + $args['id'] + ), $e ); }