Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8f7553

Browse files
committed
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 ------- cdcb6c9 made error message more clear
2 parents 36c4571 + cdcb6c9 commit d8f7553

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/Symfony/Component/Messenger/Tests/Transport/Doctrine/DoctrineTransportFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testCreateTransport()
5151

5252
/**
5353
* @expectedException \Symfony\Component\Messenger\Exception\TransportException
54-
* @expectedExceptionMessage Could not find Doctrine connection from DSN "doctrine://default".
54+
* @expectedExceptionMessage Could not find Doctrine connection from Messenger DSN "doctrine://default".
5555
*/
5656
public function testCreateTransportMustThrowAnExceptionIfManagerIsNotFound()
5757
{

src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getConfiguration(): array
6868
public static function buildConfiguration($dsn, array $options = [])
6969
{
7070
if (false === $components = parse_url($dsn)) {
71-
throw new InvalidArgumentException(sprintf('The given Doctrine DSN "%s" is invalid.', $dsn));
71+
throw new InvalidArgumentException(sprintf('The given Doctrine Messenger DSN "%s" is invalid.', $dsn));
7272
}
7373

7474
$query = [];

src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function createTransport(string $dsn, array $options, SerializerInterface
3838
try {
3939
$driverConnection = $this->registry->getConnection($configuration['connection']);
4040
} catch (\InvalidArgumentException $e) {
41-
throw new TransportException(sprintf('Could not find Doctrine connection from DSN "%s".', $dsn), 0, $e);
41+
throw new TransportException(sprintf('Could not find Doctrine connection from Messenger DSN "%s".', $dsn), 0, $e);
4242
}
4343

4444
$connection = new Connection($configuration, $driverConnection);

src/Symfony/Component/Messenger/Transport/Sync/SyncTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,22 @@ class SyncTransport implements TransportInterface
2727
{
2828
public function get(): iterable
2929
{
30-
throw new InvalidArgumentException('You cannot receive messages from the SyncTransport.');
30+
throw new InvalidArgumentException('You cannot receive messages from the Messenger SyncTransport.');
3131
}
3232

3333
public function stop(): void
3434
{
35-
throw new InvalidArgumentException('You cannot call stop() on the SyncTransport.');
35+
throw new InvalidArgumentException('You cannot call stop() on the Messenger SyncTransport.');
3636
}
3737

3838
public function ack(Envelope $envelope): void
3939
{
40-
throw new InvalidArgumentException('You cannot call ack() on the SyncTransport.');
40+
throw new InvalidArgumentException('You cannot call ack() on the Messenger SyncTransport.');
4141
}
4242

4343
public function reject(Envelope $envelope): void
4444
{
45-
throw new InvalidArgumentException('You cannot call reject() on the SyncTransport.');
45+
throw new InvalidArgumentException('You cannot call reject() on the Messenger SyncTransport.');
4646
}
4747

4848
public function send(Envelope $envelope): Envelope

src/Symfony/Component/Messenger/Transport/TransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function createTransport(string $dsn, array $options, SerializerInterface
3939
}
4040
}
4141

42-
throw new InvalidArgumentException(sprintf('No transport supports the given DSN "%s".', $dsn));
42+
throw new InvalidArgumentException(sprintf('No transport supports the given Messenger DSN "%s".', $dsn));
4343
}
4444

4545
public function supports(string $dsn, array $options): bool

0 commit comments

Comments
 (0)