Return 404s in ComposerRepository when network is disabled instead of failing hard
parent
eb3e3063b8
commit
3b6d517ce0
|
@ -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…
Reference in New Issue