Skip to content

Commit

Permalink
Update match strategy locator error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
subiabre committed Dec 18, 2024
1 parent 0d5d1c5 commit 54b45b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Matchfunding/MatchStrategy/MatchStrategyLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(

if (\array_key_exists($strategyName, $this->strategiesByName)) {
throw new \Exception(\sprintf(
"Duplicate strategy name '%s' by '%s', value already in use by '%s'",
"Duplicate MatchStrategy name '%s' by '%s', value already in use by '%s'",
$strategyName,
$strategy::class,
$this->strategiesByName[$strategyName]::class
Expand All @@ -33,7 +33,10 @@ public function __construct(
public function get(string $strategyName): ?MatchStrategyInterface
{
if (!array_key_exists($strategyName, $this->strategiesByName)) {
return null;
throw new \Exception(\sprintf(
"Could not find a MatchStrategy by the name '%s', value does not exist",
$strategyName
));
}

return $this->strategiesByName[$strategyName];
Expand Down

0 comments on commit 54b45b3

Please sign in to comment.