Fix uncaught promises when doing synchronous file downloads that fail, fixes #11563
parent
83792838c9
commit
bbd2c9613e
|
@ -107,7 +107,10 @@ class HttpDownloader
|
||||||
if ('' === $url) {
|
if ('' === $url) {
|
||||||
throw new \InvalidArgumentException('$url must not be an empty string');
|
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']);
|
$this->wait($job['id']);
|
||||||
|
|
||||||
$response = $this->getResponse($job['id']);
|
$response = $this->getResponse($job['id']);
|
||||||
|
|
Loading…
Reference in New Issue