Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CurlDownloader.php

function CurlDownloader::failResponse

Parameters

Job $job:

2 calls to CurlDownloader::failResponse()
CurlDownloader::isAuthenticatedRetryNeeded in vendor/composer/composer/src/Composer/Util/Http/CurlDownloader.php
CurlDownloader::tick in vendor/composer/composer/src/Composer/Util/Http/CurlDownloader.php

File

vendor/composer/composer/src/Composer/Util/Http/CurlDownloader.php, line 630

Class

CurlDownloader
@internal @author Jordi Boggiano <j.boggiano@seld.be> @author Nicolas Grekas <p@tchwork.com> @phpstan-type Attributes array{retryAuthFailure: bool, redirects: int<0, max>, retries: int<0, max>, storeAuth:…

Namespace

Composer\Util\Http

Code

private function failResponse(array $job, Response $response, string $errorMessage) : TransportException {
    if (null !== $job['filename']) {
        @unlink($job['filename'] . '~');
    }
    $details = '';
    if (in_array(strtolower((string) $response->getHeader('content-type')), [
        'application/json',
        'application/json; charset=utf-8',
    ], true)) {
        $details = ':' . PHP_EOL . substr($response->getBody(), 0, 200) . (strlen($response->getBody()) > 200 ? '...' : '');
    }
    return new TransportException('The "' . $job['url'] . '" file could not be downloaded (' . $errorMessage . ')' . $details, $response->getStatusCode());
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal