From e1973089d8c5ea802f3a7775d76c5bac7fbdb46a Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 19 Jul 2021 02:25:08 +0200 Subject: [PATCH] [Notifier] Allow passing a previous throwable to exceptions Signed-off-by: Alexander M. Turek --- .../Component/Notifier/Exception/TransportException.php | 2 +- .../Notifier/Exception/UnsupportedSchemeException.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Notifier/Exception/TransportException.php b/src/Symfony/Component/Notifier/Exception/TransportException.php index fade7275fa5fd..7601e595dacd2 100644 --- a/src/Symfony/Component/Notifier/Exception/TransportException.php +++ b/src/Symfony/Component/Notifier/Exception/TransportException.php @@ -23,7 +23,7 @@ class TransportException extends RuntimeException implements TransportExceptionI private $response; private $debug = ''; - public function __construct(string $message, ResponseInterface $response, int $code = 0, \Exception $previous = null) + public function __construct(string $message, ResponseInterface $response, int $code = 0, \Throwable $previous = null) { $this->response = $response; $this->debug .= $response->getInfo('debug') ?? ''; diff --git a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php index 2168d0b11dba4..8bb1aaa2ba7a1 100644 --- a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php +++ b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php @@ -91,7 +91,7 @@ class UnsupportedSchemeException extends LogicException /** * @param string[] $supported */ - public function __construct(Dsn $dsn, string $name = null, array $supported = []) + public function __construct(Dsn $dsn, string $name = null, array $supported = [], \Throwable $previous = null) { $provider = $dsn->getScheme(); if (false !== $pos = strpos($provider, '+')) { @@ -109,6 +109,6 @@ public function __construct(Dsn $dsn, string $name = null, array $supported = [] $message .= sprintf('; supported schemes for notifier "%s" are: "%s"', $name, implode('", "', $supported)); } - parent::__construct($message.'.'); + parent::__construct($message.'.', 0, $previous); } }