Skip to content

Commit 90f4202

Browse files
authored
Fix error handling in PrestissimoFileFetcher (#88)
1 parent 80c7d27 commit 90f4202

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/PrestissimoFileFetcher.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ protected function fetchWithPrestissimo($version, $destination, $override) {
5454
}
5555

5656
$successCnt = $failureCnt = 0;
57+
$errors = [];
5758
$totalCnt = count($requests);
5859
if ($totalCnt == 0) {
5960
return;
60-
}
61+
}
6162

6263
$multi = new CurlMulti();
6364
$multi->setRequests($requests);
@@ -67,12 +68,18 @@ protected function fetchWithPrestissimo($version, $destination, $override) {
6768
$result = $multi->getFinishedResults();
6869
$successCnt += $result['successCnt'];
6970
$failureCnt += $result['failureCnt'];
71+
$errors += $result['errors'];
7072
if ($this->progress) {
7173
foreach ($result['urls'] as $url) {
7274
$this->io->writeError(" - Downloading <comment>$successCnt</comment>/<comment>$totalCnt</comment>: <info>$url</info>", TRUE);
7375
}
7476
}
7577
} while ($multi->remain());
78+
79+
$urls = array_keys($errors);
80+
if ($urls) {
81+
throw new \Exception('Failed to download ' . implode(", ", $urls));
82+
}
7683
}
7784

7885
}

0 commit comments

Comments
 (0)