Skip to content

Commit 7163114

Browse files
author
brunoroux
committed
throw an exception when customer is not found
1 parent ecfb869 commit 7163114

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)