Add an exception when a Filesystem repository is corrupted
parent
d16b928baf
commit
5ffc349642
|
@ -48,13 +48,15 @@ class FilesystemRepository extends ArrayRepository implements WritableRepository
|
||||||
$packages = $this->file->read();
|
$packages = $this->file->read();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($packages)) {
|
if (!is_array($packages)) {
|
||||||
|
throw new \UnexpectedValueException('Could not parse package list from the '.$this->file.' repository');
|
||||||
|
}
|
||||||
|
|
||||||
$loader = new ArrayLoader($this->repositoryManager);
|
$loader = new ArrayLoader($this->repositoryManager);
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$this->addPackage($loader->load($package));
|
$this->addPackage($loader->load($package));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes writable repository.
|
* Writes writable repository.
|
||||||
|
|
Loading…
Reference in New Issue