Skip to content

Commit

Permalink
Throw if product service can’t get element
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Jun 28, 2019
1 parent 9e17c13 commit b24b35d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/services/ProductsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,16 @@ private function _hasProductBeenSynced ($productId)
* @return array
* @throws SiteNotFoundException
* @throws InvalidConfigException
* @throws \Exception
*/
private function _buildProductData ($productId)
{
/** @var Element $product */
$product = Craft::$app->getElements()->getElementById($productId);

if (!$product)
throw new \Exception('Unable to find element with ID: ' . $productId);

// TODO: Tidy up all helper functions by getting and storing the correct
// product and variant types, and using them later (rather that
// re-checking in every function for every variant).
Expand Down

0 comments on commit b24b35d

Please sign in to comment.