1
0
Fork 0

Return 404s in ComposerRepository when network is disabled instead of failing hard

pull/8444/head
Jordi Boggiano 2019-11-14 09:57:59 +01:00
parent eb3e3063b8
commit 3b6d517ce0
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,7 @@ use Composer\Downloader\TransportException;
use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Constraint\Constraint;
use Composer\Semver\Constraint\EmptyConstraint;
use Composer\Util\Http\Response;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>
@ -1140,6 +1141,11 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
}
$degradedMode = true;
// special error code returned when network is being artificially disabled
if ($e instanceof TransportException && $e->getStatusCode() === 499) {
return $accept(new Response(array('url' => $url), 404, array(), ''));
}
throw $e;
};