From de09204318a2d695a4dd62c9ba4860576f08e116 Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Mon, 1 Jul 2024 12:20:32 +0330 Subject: [PATCH 1/2] set previous exception on `HttpResponseException` --- src/Illuminate/Http/Exceptions/HttpResponseException.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Exceptions/HttpResponseException.php b/src/Illuminate/Http/Exceptions/HttpResponseException.php index b27052f02c15..e4357c7351fb 100644 --- a/src/Illuminate/Http/Exceptions/HttpResponseException.php +++ b/src/Illuminate/Http/Exceptions/HttpResponseException.php @@ -4,6 +4,7 @@ use RuntimeException; use Symfony\Component\HttpFoundation\Response; +use Throwable; class HttpResponseException extends RuntimeException { @@ -20,8 +21,10 @@ class HttpResponseException extends RuntimeException * @param \Symfony\Component\HttpFoundation\Response $response * @return void */ - public function __construct(Response $response) + public function __construct(Response $response, ?Throwable $previous = null) { + parent::__construct($previous?->getMessage() ?? '', $previous?->getCode() ?? 0, $previous); + $this->response = $response; } From 4f1ef9d80114d4308f1049befaf21d8f9e78c942 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Mon, 1 Jul 2024 11:03:25 +0200 Subject: [PATCH 2/2] Update src/Illuminate/Http/Exceptions/HttpResponseException.php Co-authored-by: Julius Kiekbusch --- src/Illuminate/Http/Exceptions/HttpResponseException.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Http/Exceptions/HttpResponseException.php b/src/Illuminate/Http/Exceptions/HttpResponseException.php index e4357c7351fb..c45268680aeb 100644 --- a/src/Illuminate/Http/Exceptions/HttpResponseException.php +++ b/src/Illuminate/Http/Exceptions/HttpResponseException.php @@ -19,6 +19,7 @@ class HttpResponseException extends RuntimeException * Create a new HTTP response exception instance. * * @param \Symfony\Component\HttpFoundation\Response $response + * @param \Throwable $previous * @return void */ public function __construct(Response $response, ?Throwable $previous = null)