Skip to content

Commit 76d75ee

Browse files
committed
Catch InvalidArgumentException if repository for private recipes is empty, Closes #30
1 parent b5f86fe commit 76d75ee

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/RecipeRepo/RecipeRepo.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use App\Event\RepoStatusChangedEvent;
1515
use App\Service\Cache;
1616
use Cz\Git\GitException;
17+
use InvalidArgumentException;
1718
use Psr\Log\LoggerInterface;
1819
use Symfony\Component\Cache\Simple\FilesystemCache;
1920
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -179,12 +180,16 @@ public function getRecipeDirectories()
179180
return [];
180181
}
181182

182-
$finder = new Finder();
183-
return $finder->ignoreUnreadableDirs()
184-
->in($this->fullRepoPath . '/*/*')
185-
->depth(0)
186-
->exclude('.git')
187-
->directories();
183+
try {
184+
return (new Finder())
185+
->ignoreUnreadableDirs()
186+
->in($this->fullRepoPath . '/*/*')
187+
->depth(0)
188+
->exclude('.git')
189+
->directories();
190+
} catch (InvalidArgumentException $e) {
191+
return [];
192+
}
188193
}
189194

190195
/**
@@ -272,6 +277,4 @@ public function jsonSerialize()
272277
'url' => $this->repoUrl
273278
];
274279
}
275-
276-
277280
}

0 commit comments

Comments
 (0)