Skip to content

Commit 1a6accb

Browse files
Remove full DSNs from exception messages
1 parent 73bfa95 commit 1a6accb

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Tests/Transport/DsnTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,17 +155,17 @@ public static function invalidDsnProvider(): iterable
155155
{
156156
yield [
157157
'some://',
158-
'The "some://" notifier DSN is invalid.',
158+
'The notifier DSN is invalid.',
159159
];
160160

161161
yield [
162162
'//slack',
163-
'The "//slack" notifier DSN must contain a scheme.',
163+
'The notifier DSN must contain a scheme.',
164164
];
165165

166166
yield [
167167
'file:///some/path',
168-
'The "file:///some/path" notifier DSN must contain a host (use "default" by default).',
168+
'The notifier DSN must contain a host (use "default" by default).',
169169
];
170170
}
171171

Transport/AbstractTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function getUser(Dsn $dsn): string
4646
{
4747
$user = $dsn->getUser();
4848
if (null === $user) {
49-
throw new IncompleteDsnException('User is not set.', $dsn->getOriginalDsn());
49+
throw new IncompleteDsnException('User is not set.', $dsn->getScheme().'://'.$dsn->getHost());
5050
}
5151

5252
return $user;

Transport/Dsn.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ public function __construct(string $dsn)
3434
$this->originalDsn = $dsn;
3535

3636
if (false === $parsedDsn = parse_url($dsn)) {
37-
throw new InvalidArgumentException(sprintf('The "%s" notifier DSN is invalid.', $dsn));
37+
throw new InvalidArgumentException('The notifier DSN is invalid.');
3838
}
3939

4040
if (!isset($parsedDsn['scheme'])) {
41-
throw new InvalidArgumentException(sprintf('The "%s" notifier DSN must contain a scheme.', $dsn));
41+
throw new InvalidArgumentException('The notifier DSN must contain a scheme.');
4242
}
4343
$this->scheme = $parsedDsn['scheme'];
4444

4545
if (!isset($parsedDsn['host'])) {
46-
throw new InvalidArgumentException(sprintf('The "%s" notifier DSN must contain a host (use "default" by default).', $dsn));
46+
throw new InvalidArgumentException('The notifier DSN must contain a host (use "default" by default).');
4747
}
4848
$this->host = $parsedDsn['host'];
4949

0 commit comments

Comments
 (0)