version 1.5
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Common\BatchResult;
|
||||
use Http\Client\Exception\TransferException;
|
||||
|
||||
/**
|
||||
* This exception is thrown when HttpClient::sendRequests led to at least one failure.
|
||||
*
|
||||
* It gives access to a BatchResult with the request-exception and request-response pairs.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
final class BatchException extends TransferException
|
||||
{
|
||||
/**
|
||||
* @var BatchResult
|
||||
*/
|
||||
private $result;
|
||||
|
||||
public function __construct(BatchResult $result)
|
||||
{
|
||||
$this->result = $result;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the BatchResult that contains all responses and exceptions.
|
||||
*/
|
||||
public function getResult(): BatchResult
|
||||
{
|
||||
return $this->result;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Thrown when circular redirection is detected.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class CircularRedirectionException extends HttpException
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Thrown when there is a client error (4xx).
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class ClientErrorException extends HttpException
|
||||
{
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Exception\TransferException;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Thrown when a http client match in the HTTPClientRouter.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class HttpClientNoMatchException extends TransferException
|
||||
{
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function __construct(string $message, RequestInterface $request, \Exception $previous = null)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
parent::__construct($message, 0, $previous);
|
||||
}
|
||||
|
||||
public function getRequest(): RequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Exception\TransferException;
|
||||
|
||||
/**
|
||||
* Thrown when a http client cannot be chosen in a pool.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class HttpClientNotFoundException extends TransferException
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Exception\RequestException;
|
||||
|
||||
/**
|
||||
* Thrown when the Plugin Client detects an endless loop.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class LoopException extends RequestException
|
||||
{
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Redirect location cannot be chosen.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class MultipleRedirectionException extends HttpException
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Http\Client\Common\Exception;
|
||||
|
||||
use Http\Client\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Thrown when there is a server error (5xx).
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class ServerErrorException extends HttpException
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user