Skip to content

Commit

Permalink
[10.x] Set previous exception on HttpResponseException (#51986)
Browse files Browse the repository at this point in the history
* set previous exception on `HttpResponseException`

* Update src/Illuminate/Http/Exceptions/HttpResponseException.php

Co-authored-by: Julius Kiekbusch <contact@julius-kiekbusch.de>

---------

Co-authored-by: Dries Vints <dries@vints.be>
Co-authored-by: Julius Kiekbusch <contact@julius-kiekbusch.de>
  • Loading branch information
3 people authored Jul 2, 2024
1 parent 35f07d3 commit 57be419
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Illuminate/Http/Exceptions/HttpResponseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use RuntimeException;
use Symfony\Component\HttpFoundation\Response;
use Throwable;

class HttpResponseException extends RuntimeException
{
Expand All @@ -18,10 +19,13 @@ 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)
public function __construct(Response $response, ?Throwable $previous = null)
{
parent::__construct($previous?->getMessage() ?? '', $previous?->getCode() ?? 0, $previous);

$this->response = $response;
}

Expand Down

0 comments on commit 57be419

Please sign in to comment.