Skip to content

Commit

Permalink
Throw exception when the store is not found (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
royduin authored Nov 24, 2023
1 parent de788cb commit 1c42c5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Rapidez.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ public function getStores(callable|int|string $store = null): array

public function getStore(callable|int|string $store): array
{
return Arr::first($this->getStores($store));
$stores = $this->getStores($store);

throw_if(
empty($stores),
StoreNotFoundException::class,
'Store not found.'
);

return Arr::first($stores);
}

public function setStore(Store|array|callable|int|string $store): void
Expand Down

0 comments on commit 1c42c5a

Please sign in to comment.