From eac014febd2f4ca5835d57d2fadaec1398596e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Sat, 16 Mar 2019 02:50:06 +0100 Subject: [PATCH] [Messenger] Display a nice error when connection fail --- .../Messenger/Transport/AmqpExt/Connection.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php index 6d1c57b6f248d..f1875a8b49101 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php @@ -199,10 +199,14 @@ public function channel(): \AMQPChannel $connection = $this->amqpFactory->createConnection($this->connectionCredentials); $connectMethod = 'true' === ($this->connectionCredentials['persistent'] ?? 'false') ? 'pconnect' : 'connect'; - if (false === $connection->{$connectMethod}()) { - throw new \AMQPException('Could not connect to the AMQP server. Please verify the provided DSN.'); - } + try { + $connection->{$connectMethod}(); + } catch (\AMQPConnectionException $e) { + $credentials = $this->connectionCredentials; + $credentials['password'] = '********'; + throw new \AMQPException(sprintf('Could not connect to the AMQP server. Please verify the provided DSN. (%s)', json_encode($credentials)), 0, $e); + } $this->amqpChannel = $this->amqpFactory->createChannel($connection); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy