public function build(array $data) { try { if (!$this->_validator->validateRow($data)) { throw new Exception\UploadException('Row is not valid!'); } $this->_addProductType($data); $this->_addAuthorship(); $this->_addData($data); $this->_setPrices($data); return $this->_product; } catch (\Exception $e) { $this->_validator->invalidateRow($data); $key = $this->_headingKeys->getKey('name'); if (array_key_exists($key, $data)) { throw new Exception\UploadFrontEndException($e->getMessage(), 'ms.commerce.product.upload.build-fail', ['%productName%' => $data[$key], '%message%' => $e->getMessage()]); } throw $e; } }