when I use the sylius.factory.product
here https://docs.sylius.com/en/1.6/book/products/products.html
Adding Product
/** @var ProductFactoryInterface $productFactory **/
$productFactory = $this->get('sylius.factory.product');
/** @var ProductInterface $product */
$product = $productFactory->createNew();
$product->setName('T-Shirt');
$product->setCode('00001');
$product->setSlug('t-shirt');
/** @var RepositoryInterface $productRepository */
$productRepository = $this->get('sylius.repository.product');
$productRepository->add($product);
and set the value of Code (has unique identifier) to a value already exists I get an exception I want to get the validation message "Product code must be unique." message provided by sylius
How to get this done?