[Messenger] changed exceptions to use component's one
This commit is contained in:
parent
f2f4cd82c3
commit
4e0e5e5fdb
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Messenger\Handler;
|
||||
|
||||
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Represents a collection of message handlers.
|
||||
*
|
||||
@ -29,7 +31,7 @@ class ChainHandler
|
||||
public function __construct(array $handlers)
|
||||
{
|
||||
if (empty($handlers)) {
|
||||
throw new \InvalidArgumentException('A collection of message handlers requires at least one handler.');
|
||||
throw new InvalidArgumentException('A collection of message handlers requires at least one handler.');
|
||||
}
|
||||
|
||||
$this->handlers = $handlers;
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Messenger\Transport\AmqpExt;
|
||||
|
||||
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* An AMQP connection.
|
||||
*
|
||||
@ -51,7 +53,7 @@ class Connection
|
||||
public static function fromDsn(string $dsn, array $options = array(), bool $debug = false, AmqpFactory $amqpFactory = null): self
|
||||
{
|
||||
if (false === $parsedUrl = parse_url($dsn)) {
|
||||
throw new \InvalidArgumentException(sprintf('The given AMQP DSN "%s" is invalid.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('The given AMQP DSN "%s" is invalid.', $dsn));
|
||||
}
|
||||
|
||||
$pathParts = isset($parsedUrl['path']) ? explode('/', trim($parsedUrl['path'], '/')) : array();
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Messenger\Transport\Serialization;
|
||||
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
@ -36,11 +37,11 @@ class Serializer implements DecoderInterface, EncoderInterface
|
||||
public function decode(array $encodedEnvelope): Envelope
|
||||
{
|
||||
if (empty($encodedEnvelope['body']) || empty($encodedEnvelope['headers'])) {
|
||||
throw new \InvalidArgumentException('Encoded envelope should have at least a `body` and some `headers`.');
|
||||
throw new InvalidArgumentException('Encoded envelope should have at least a "body" and some "headers".');
|
||||
}
|
||||
|
||||
if (empty($encodedEnvelope['headers']['type'])) {
|
||||
throw new \InvalidArgumentException('Encoded envelope does not have a `type` header.');
|
||||
throw new InvalidArgumentException('Encoded envelope does not have a "type" header.');
|
||||
}
|
||||
|
||||
$envelopeItems = $this->decodeEnvelopeItems($encodedEnvelope);
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Messenger\Transport;
|
||||
|
||||
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||
*/
|
||||
@ -34,7 +36,7 @@ class TransportFactory implements TransportFactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('No transport supports the given DSN "%s".', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('No transport supports the given DSN "%s".', $dsn));
|
||||
}
|
||||
|
||||
public function supports(string $dsn, array $options): bool
|
||||
|
Reference in New Issue
Block a user