1
0
Fork 0

Add an exception when a Filesystem repository is corrupted

pull/69/head
Fabien Potencier 2011-10-29 07:46:05 +02:00
parent d16b928baf
commit 5ffc349642
1 changed files with 7 additions and 5 deletions

View File

@ -48,11 +48,13 @@ class FilesystemRepository extends ArrayRepository implements WritableRepository
$packages = $this->file->read(); $packages = $this->file->read();
} }
if (is_array($packages)) { if (!is_array($packages)) {
$loader = new ArrayLoader($this->repositoryManager); throw new \UnexpectedValueException('Could not parse package list from the '.$this->file.' repository');
foreach ($packages as $package) { }
$this->addPackage($loader->load($package));
} $loader = new ArrayLoader($this->repositoryManager);
foreach ($packages as $package) {
$this->addPackage($loader->load($package));
} }
} }