minor #31259 Make error message more clear (fabpot)
This PR was merged into the 4.3-dev branch.
Discussion
----------
Make error message more clear
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
When you get the following error message `No transport supports the given DSN "...".`, you might think that this relates to a mailer transport or a messenger transport. Let's make this real clear.
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
-->
Commits
-------
cdcb6c9969
made error message more clear
This commit is contained in:
commit
d8f7553f6c
@ -51,7 +51,7 @@ class DoctrineTransportFactoryTest extends TestCase
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Messenger\Exception\TransportException
|
||||
* @expectedExceptionMessage Could not find Doctrine connection from DSN "doctrine://default".
|
||||
* @expectedExceptionMessage Could not find Doctrine connection from Messenger DSN "doctrine://default".
|
||||
*/
|
||||
public function testCreateTransportMustThrowAnExceptionIfManagerIsNotFound()
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ class Connection
|
||||
public static function buildConfiguration($dsn, array $options = [])
|
||||
{
|
||||
if (false === $components = parse_url($dsn)) {
|
||||
throw new InvalidArgumentException(sprintf('The given Doctrine DSN "%s" is invalid.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('The given Doctrine Messenger DSN "%s" is invalid.', $dsn));
|
||||
}
|
||||
|
||||
$query = [];
|
||||
|
@ -38,7 +38,7 @@ class DoctrineTransportFactory implements TransportFactoryInterface
|
||||
try {
|
||||
$driverConnection = $this->registry->getConnection($configuration['connection']);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
throw new TransportException(sprintf('Could not find Doctrine connection from DSN "%s".', $dsn), 0, $e);
|
||||
throw new TransportException(sprintf('Could not find Doctrine connection from Messenger DSN "%s".', $dsn), 0, $e);
|
||||
}
|
||||
|
||||
$connection = new Connection($configuration, $driverConnection);
|
||||
|
@ -27,22 +27,22 @@ class SyncTransport implements TransportInterface
|
||||
{
|
||||
public function get(): iterable
|
||||
{
|
||||
throw new InvalidArgumentException('You cannot receive messages from the SyncTransport.');
|
||||
throw new InvalidArgumentException('You cannot receive messages from the Messenger SyncTransport.');
|
||||
}
|
||||
|
||||
public function stop(): void
|
||||
{
|
||||
throw new InvalidArgumentException('You cannot call stop() on the SyncTransport.');
|
||||
throw new InvalidArgumentException('You cannot call stop() on the Messenger SyncTransport.');
|
||||
}
|
||||
|
||||
public function ack(Envelope $envelope): void
|
||||
{
|
||||
throw new InvalidArgumentException('You cannot call ack() on the SyncTransport.');
|
||||
throw new InvalidArgumentException('You cannot call ack() on the Messenger SyncTransport.');
|
||||
}
|
||||
|
||||
public function reject(Envelope $envelope): void
|
||||
{
|
||||
throw new InvalidArgumentException('You cannot call reject() on the SyncTransport.');
|
||||
throw new InvalidArgumentException('You cannot call reject() on the Messenger SyncTransport.');
|
||||
}
|
||||
|
||||
public function send(Envelope $envelope): Envelope
|
||||
|
@ -39,7 +39,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 Messenger DSN "%s".', $dsn));
|
||||
}
|
||||
|
||||
public function supports(string $dsn, array $options): bool
|
||||
|
Reference in New Issue
Block a user