diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index a3ec9c570..8f225cbd3 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -135,7 +135,12 @@ abstract class BasePackage implements PackageInterface public function setRepository(RepositoryInterface $repository) { if ($this->repository && $repository !== $this->repository) { - throw new \LogicException('A package can only be added to one repository'); + throw new \LogicException(sprintf( + 'Package "%s" cannot be added to repository "%s" as it is already in repository "%s".', + $this->getPrettyName(), + $repository->getRepoName(), + $this->repository->getRepoName(), + )); } $this->repository = $repository; }