/** * @param int $code * @param RequestInterface $request * @param array $requestOptions * @param ResponseInterface $response * @param TransferInfo $transferInfo * @param \Exception|null $previous * * @throws \OutOfRangeException If the code is not recognized. */ public function __construct($code, RequestInterface $request, array $requestOptions, ResponseInterface $response, TransferInfo $transferInfo, \Exception $previous = null) { $this->type = self::getTypeForCode($code); $this->request = $request; $this->requestOptions = $requestOptions; $this->response = $response; $this->transferInfo = $transferInfo; parent::__construct(sprintf('An error occurred while parsing the response: %s', $this->type), $code, $previous); }
/** * @param int $code * @param RequestInterface $request * @param array $requestOptions * @param ResponseInterface|null $response * @param TransferInfo $transferInfo * * @throws \InvalidArgumentException If the error code is invalid. */ public function __construct($code, RequestInterface $request, array $requestOptions, ResponseInterface $response = null, TransferInfo $transferInfo) { if (!isset(self::$errors[$code])) { throw new \InvalidArgumentException(sprintf('Error code %d is not recognized.', $code)); } $this->request = $request; $this->requestOptions = $requestOptions; $this->response = $response; $this->transferInfo = $transferInfo; parent::__construct(sprintf('An error occurred in the network layer: %s', self::$errors[$code]), $code + self::SHIFT_ERROR_CODE); }
/** * @param ExceptionData $exceptionData * @param RequestInterface $request * @param array $requestOptions * @param ResponseInterface $response * @param TransferInfo $transferInfo */ public function __construct(ExceptionData $exceptionData, RequestInterface $request, array $requestOptions, ResponseInterface $response, TransferInfo $transferInfo) { $this->exceptionData = $exceptionData; $this->request = $request; $this->requestOptions = $requestOptions; $this->response = $response; $this->transferInfo = $transferInfo; parent::__construct(sprintf('An error occurred in the Oxygen module: %s', $exceptionData->getType()), $exceptionData->getCode()); }