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

main
Jordi Boggiano 5 years ago
parent eb3e3063b8
commit 3b6d517ce0
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -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;
};

Loading…
Cancel
Save