Skip to content

Commit c3b7395

Browse files
author
Bruno
authored
Merge pull request #17 from StoreFactory/feature/YP-3387
throw an exception when customer is not found
2 parents ecfb869 + 7163114 commit c3b7395

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Api/Customer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function getCustomerByEmail(string $customerEmail): array
4747
{
4848
$customers = $this->getListCustomersByEmail($customerEmail);
4949

50+
if (count($customers) === 0) {
51+
throw new \LogicException(sprintf('customer with email %s not found', $customerEmail));
52+
}
53+
5054
return $this->getCustomerById($customers[0]['customer_id']);
5155
}
5256

0 commit comments

Comments
 (0)