From 8ba6a2c482d3fce9d450b702098ca033bbe42de4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 23 Jan 2023 14:36:51 +0100 Subject: [PATCH] Remove full DSNs from exception messages --- Tests/Transport/ConnectionTest.php | 2 +- Transport/Connection.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Transport/ConnectionTest.php b/Tests/Transport/ConnectionTest.php index 1b39dc7..32abfd5 100644 --- a/Tests/Transport/ConnectionTest.php +++ b/Tests/Transport/ConnectionTest.php @@ -33,7 +33,7 @@ class ConnectionTest extends TestCase public function testItCannotBeConstructedWithAWrongDsn() { $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('The given AMQP DSN "amqp://:" is invalid.'); + $this->expectExceptionMessage('The given AMQP DSN is invalid.'); Connection::fromDsn('amqp://:'); } diff --git a/Transport/Connection.php b/Transport/Connection.php index 166031b..0357575 100644 --- a/Transport/Connection.php +++ b/Transport/Connection.php @@ -180,7 +180,7 @@ public static function fromDsn(string $dsn, array $options = [], AmqpFactory $am if (false === $parsedUrl = parse_url($dsn)) { // this is a valid URI that parse_url cannot handle when you want to pass all parameters as options if (!\in_array($dsn, ['amqp://', 'amqps://'])) { - throw new InvalidArgumentException(sprintf('The given AMQP DSN "%s" is invalid.', $dsn)); + throw new InvalidArgumentException('The given AMQP DSN is invalid.'); } $parsedUrl = [];