Skip to content

Commit

Permalink
Fixed bug in exception and fixed null value in variant translation
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Oct 1, 2019
1 parent 80db253 commit aa63257
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Exception/GenerateBatchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

final class GenerateBatchException extends RuntimeException implements ExceptionInterface
{
/** @var string */
private $originalMessage;

/** @var int */
private $feedId;

Expand All @@ -24,6 +27,8 @@ final class GenerateBatchException extends RuntimeException implements Exception
public function __construct(string $message, Throwable $previous)
{
parent::__construct($message, 0, $previous);

$this->originalMessage = $message;
}

public function getFeedId(): int
Expand Down Expand Up @@ -76,6 +81,8 @@ public function setLocaleCode(string $localeCode): void

private function updateMessage(): void
{
$this->message = $this->originalMessage;

if (null !== $this->feedId) {
$this->message .= ' | Feed: ' . $this->feedId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function getContextList(object $variant, ChannelInterface $channel, Local

[$price, $salePrice] = $this->getPrices($variant, $channel);

$data = new Product($variant->getCode(), $translation->getName(), $productTranslation->getDescription(), $link,
$data = new Product($variant->getCode(), $translation->getName() ?? $productTranslation->getName(), $productTranslation->getDescription(), $link,
$imageLink, $this->getAvailability($variant), $price);

$data->setSalePrice($salePrice);
Expand Down

0 comments on commit aa63257

Please sign in to comment.