1
0
Fork 0

Fix uncaught promises when doing synchronous file downloads that fail, fixes #11563

pull/11601/head
Jordi Boggiano 2023-08-30 11:19:47 +02:00
parent 83792838c9
commit bbd2c9613e
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 4 additions and 1 deletions

View File

@ -107,7 +107,10 @@ class HttpDownloader
if ('' === $url) {
throw new \InvalidArgumentException('$url must not be an empty string');
}
[$job] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null], true);
[$job, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null], true);
$promise->catch(function (\Throwable $e) {
// suppress error as it is rethrown to the caller by getResponse() a few lines below
});
$this->wait($job['id']);
$response = $this->getResponse($job['id']);