Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit 222ec5f

Browse files
committed
#961: ShippingAddressInput.postcode: String, is not required by Schema
1 parent 1f03323 commit 222ec5f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/Address/SaveQuoteAddressToCustomerAddressBook.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Customer\Api\Data\AddressInterfaceFactory;
1313
use Magento\Customer\Api\Data\RegionInterface;
1414
use Magento\Customer\Api\Data\RegionInterfaceFactory;
15+
use Magento\Framework\Exception\InputException;
1516
use Magento\Framework\Exception\LocalizedException;
1617
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1718
use Magento\Quote\Model\Quote\Address as QuoteAddress;
@@ -89,8 +90,15 @@ public function execute(QuoteAddress $quoteAddress, int $customerId): void
8990
$customerAddress->setRegion($region);
9091

9192
$this->addressRepository->save($customerAddress);
92-
} catch (LocalizedException $e) {
93-
throw new GraphQlInputException(__($e->getMessage()), $e);
93+
} catch (InputException $inputException) {
94+
$graphQlInputException = new GraphQlInputException(__($inputException->getMessage()));
95+
$errors = $inputException->getErrors();
96+
foreach ($errors as $error) {
97+
$graphQlInputException->addError(new GraphQlInputException(__($error->getMessage())));
98+
}
99+
throw $graphQlInputException;
100+
} catch (LocalizedException $exception) {
101+
throw new GraphQlInputException(__($exception->getMessage()), $exception);
94102
}
95103
}
96104
}

0 commit comments

Comments
 (0)