|  1:  | <?php declare(strict_types=1); | 
|  2:  |  | 
|  3:  | namespace Salient\Curler\Exception; | 
|  4:  |  | 
|  5:  | use Psr\Http\Message\RequestInterface as PsrRequestInterface; | 
|  6:  | use Salient\Core\Exception\Exception; | 
|  7:  | use Salient\Http\Message\Request; | 
|  8:  | use Salient\Utility\Format; | 
|  9:  | use Throwable; | 
| 10:  |  | 
| 11:  |  | 
| 12:  |  | 
| 13:  |  | 
| 14:  | class GenericRequestException extends Exception | 
| 15:  | { | 
| 16:  |     protected PsrRequestInterface $Request; | 
| 17:  |      | 
| 18:  |     protected array $Data; | 
| 19:  |  | 
| 20:  |      | 
| 21:  |  | 
| 22:  |  | 
| 23:  |     public function __construct( | 
| 24:  |         string $message, | 
| 25:  |         PsrRequestInterface $request, | 
| 26:  |         array $data = [], | 
| 27:  |         ?Throwable $previous = null | 
| 28:  |     ) { | 
| 29:  |         $this->Request = $request; | 
| 30:  |         $this->Data = $data; | 
| 31:  |  | 
| 32:  |         parent::__construct($message, $previous); | 
| 33:  |     } | 
| 34:  |  | 
| 35:  |      | 
| 36:  |  | 
| 37:  |  | 
| 38:  |     public function getRequest(): PsrRequestInterface | 
| 39:  |     { | 
| 40:  |         return $this->Request; | 
| 41:  |     } | 
| 42:  |  | 
| 43:  |      | 
| 44:  |  | 
| 45:  |  | 
| 46:  |     public function getMetadata(): array | 
| 47:  |     { | 
| 48:  |         return [ | 
| 49:  |             'Request' => (string) Request::fromPsr7($this->Request), | 
| 50:  |             'Data' => $this->Data | 
| 51:  |                 ? Format::array($this->Data) | 
| 52:  |                 : '<none>', | 
| 53:  |         ]; | 
| 54:  |     } | 
| 55:  | } | 
| 56:  |  |