Skip to content

Commit 6daaf31

Browse files
32615 changes with exception messages
1 parent 9ced6e0 commit 6daaf31

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/AssignCustomerToGuestCart.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@ public function resolve(
7979
$guestMaskedCartId = $args['cart_id'];
8080
$storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
8181

82-
$this->getCartForUser->execute($guestMaskedCartId,null, $storeId);
82+
$this->getCartForUser->execute($guestMaskedCartId, null, $storeId);
8383

8484
try {
8585
$this->guestCartManagementInterface->assignCustomer($guestMaskedCartId, $currentUserId, $storeId);
8686
} catch (NoSuchEntityException $e) {
87-
$message = $e->getMessage();
88-
if (str_contains($message, 'No such entity with cartId = ')) {
89-
$message = __('Could not find a cart with ID "%masked_cart_id"', ['masked_cart_id' => $guestMaskedCartId]);
90-
} else {
91-
$message = __($e->getMessage());
92-
}
93-
throw new GraphQlNoSuchEntityException($message, $e);
87+
throw new GraphQlNoSuchEntityException(
88+
__('Could not find a cart with ID "%masked_cart_id"', ['masked_cart_id' => $guestMaskedCartId]),
89+
$e
90+
);
9491
} catch (StateException $e) {
9592
throw new GraphQlInputException(__($e->getMessage()), $e);
9693
} catch (LocalizedException $e) {
97-
throw new GraphQlInputException(__('Unable to assign the customer to the guest cart: %message', ['message' => $e->getMessage()]), $e);
94+
throw new GraphQlInputException(
95+
__('Unable to assign the customer to the guest cart: %message', ['message' => $e->getMessage()]),
96+
$e
97+
);
9898
}
9999

100100
try {

0 commit comments

Comments
 (0)