Skip to content

Commit 57be419

Browse files
hafezdivandaridriesvintsJubeki
authored
[10.x] Set previous exception on HttpResponseException (#51986)
* set previous exception on `HttpResponseException` * Update src/Illuminate/Http/Exceptions/HttpResponseException.php Co-authored-by: Julius Kiekbusch <[email protected]> --------- Co-authored-by: Dries Vints <[email protected]> Co-authored-by: Julius Kiekbusch <[email protected]>
1 parent 35f07d3 commit 57be419

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Illuminate/Http/Exceptions/HttpResponseException.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use RuntimeException;
66
use Symfony\Component\HttpFoundation\Response;
7+
use Throwable;
78

89
class HttpResponseException extends RuntimeException
910
{
@@ -18,10 +19,13 @@ class HttpResponseException extends RuntimeException
1819
* Create a new HTTP response exception instance.
1920
*
2021
* @param \Symfony\Component\HttpFoundation\Response $response
22+
* @param \Throwable $previous
2123
* @return void
2224
*/
23-
public function __construct(Response $response)
25+
public function __construct(Response $response, ?Throwable $previous = null)
2426
{
27+
parent::__construct($previous?->getMessage() ?? '', $previous?->getCode() ?? 0, $previous);
28+
2529
$this->response = $response;
2630
}
2731

0 commit comments

Comments
 (0)