Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eac014f

Browse filesBrowse files
committed
[Messenger] Display a nice error when connection fail
1 parent 0762d2d commit eac014f
Copy full SHA for eac014f

File tree

1 file changed

+7
-3
lines changed
Filter options

1 file changed

+7
-3
lines changed

‎src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,14 @@ public function channel(): \AMQPChannel
199199
$connection = $this->amqpFactory->createConnection($this->connectionCredentials);
200200
$connectMethod = 'true' === ($this->connectionCredentials['persistent'] ?? 'false') ? 'pconnect' : 'connect';
201201

202-
if (false === $connection->{$connectMethod}()) {
203-
throw new \AMQPException('Could not connect to the AMQP server. Please verify the provided DSN.');
204-
}
202+
try {
203+
$connection->{$connectMethod}();
204+
} catch (\AMQPConnectionException $e) {
205+
$credentials = $this->connectionCredentials;
206+
$credentials['password'] = '********';
205207

208+
throw new \AMQPException(sprintf('Could not connect to the AMQP server. Please verify the provided DSN. (%s)', json_encode($credentials)), 0, $e);
209+
}
206210
$this->amqpChannel = $this->amqpFactory->createChannel($connection);
207211
}
208212

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.