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 0c6f0b4

Browse filesBrowse files
committed
feature #30583 [Messenger] Display a nice error when connection fail (lyrixx)
This PR was merged into the 4.3-dev branch. Discussion ---------- [Messenger] Display a nice error when connection fail | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | kind of | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | ### Before: ![image](https://user-images.githubusercontent.com/408368/54469293-6bc12f80-4796-11e9-897c-f07504132214.png) ### Now: ![image](https://user-images.githubusercontent.com/408368/54469287-5c41e680-4796-11e9-80ac-692899693542.png) Commits ------- eac014f [Messenger] Display a nice error when connection fail
2 parents 0762d2d + eac014f commit 0c6f0b4
Copy full SHA for 0c6f0b4

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.