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

Breadcrumb

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

class BadResponseException

Exception when an HTTP error occurs (4xx or 5xx error)

Hierarchy

  • class \GuzzleHttp\Exception\TransferException extends \GuzzleHttp\Exception\RuntimeException implements \GuzzleHttp\Exception\GuzzleException
    • class \GuzzleHttp\Exception\RequestException extends \GuzzleHttp\Exception\TransferException implements \Psr\Http\Client\RequestExceptionInterface
      • class \GuzzleHttp\Exception\BadResponseException extends \GuzzleHttp\Exception\RequestException

Expanded class hierarchy of BadResponseException

1 file declares its use of BadResponseException
RedirectMiddleware.php in vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php

File

vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php, line 11

Namespace

GuzzleHttp\Exception
View source
class BadResponseException extends RequestException {
    public function __construct(string $message, RequestInterface $request, ResponseInterface $response, ?\Throwable $previous = null, array $handlerContext = []) {
        parent::__construct($message, $request, $response, $previous, $handlerContext);
    }
    
    /**
     * Current exception and the ones that extend it will always have a response.
     */
    public function hasResponse() : bool {
        return true;
    }
    
    /**
     * This function narrows the return type from the parent class and does not allow it to be nullable.
     */
    public function getResponse() : ResponseInterface {
        
        /** @var ResponseInterface */
        return parent::getResponse();
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
BadResponseException::getResponse public function This function narrows the return type from the parent class and does not allow it to be nullable. Overrides RequestException::getResponse
BadResponseException::hasResponse public function Current exception and the ones that extend it will always have a response. Overrides RequestException::hasResponse
BadResponseException::__construct public function Overrides RequestException::__construct
RequestException::$handlerContext private property
RequestException::$request private property
RequestException::$response private property
RequestException::create public static function Factory method to create a new exception with a normalized error message
RequestException::getHandlerContext public function Get contextual information about the error from the underlying handler.
RequestException::getRequest public function Get the request that caused the exception Overrides RequestExceptionInterface::getRequest
RequestException::wrapException public static function Wrap non-RequestExceptions with a RequestException

API Navigation

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