Skip to content

Commit

Permalink
Distinct error message if data directory is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed May 8, 2024
1 parent aedf6b5 commit 0c08125
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Fetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ public function getLatestBundle($checkEd25519Signature = null, $checkChronicle =
$checkChronicle = (bool) (static::CHECK_CHRONICLE_BY_DEFAULT && $sodiumCompatIsntSlow);
}

/** @var int $bundleIndex */
$bundleIndex = 0;
/** @var Bundle $bundle */
foreach ($this->listBundles('', $this->trustChannel) as $bundle) {
$bundlesAvailable = $this->listBundles('', $this->trustChannel);
if (empty($bundlesAvailable)) {
throw new BundleException('No bundles were found in the data directory.');
}
foreach ($bundlesAvailable as $bundle) {
if ($bundle->hasCustom()) {
$validator = $bundle->getValidator();
} else {
Expand Down

0 comments on commit 0c08125

Please sign in to comment.