/**
* @return false|string false on failed download, or a path to the downloaded zip file
* @throws PluginInstallerException
*/
private function downloadPluginFromMarketplace()
{
try {
return $this->marketplaceClient->download($this->pluginName);
} catch (\Exception $e) {
try {
$downloadUrl = $this->marketplaceClient->getDownloadUrl($this->pluginName);
$errorMessage = sprintf('Failed to download plugin from %s: %s', $downloadUrl, $e->getMessage());
} catch (\Exception $ex) {
$errorMessage = sprintf('Failed to download plugin: %s', $e->getMessage());
}
throw new PluginInstallerException($errorMessage);
}
}