Skip to content

Commit 895bc6b

Browse files
committed
Implement HttpExceptionInterface
1 parent 310806f commit 895bc6b

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎ProcessMaker/Exception/HttpResponseException.php‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@
55
use Exception;
66
use GuzzleHttp\Psr7\Response;
77
use Illuminate\Support\Str;
8+
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
89

910
/**
1011
* Thrown if an expression failed to be parsed
1112
*
1213
* @package ProcessMaker\Exceptions
1314
*/
1415

15-
class HttpResponseException extends Exception
16+
class HttpResponseException extends Exception implements HttpExceptionInterface
1617
{
1718
public $status;
1819
public $body;
20+
private $headers;
1921

2022
/**
2123
* @param Response $response
@@ -24,9 +26,18 @@ public function __construct(Response $response)
2426
{
2527
$this->status = $response->getStatusCode();
2628
$this->body = $response->getBody()->getContents();
29+
$this->headers = $response->getHeaders();
2730
parent::__construct(__("Unexpected response (status=:status)\n:body", [
2831
'status' => $this->status,
2932
'body' => Str::limit($this->body, 100),
3033
]), 0);
3134
}
35+
36+
public function getStatusCode() {
37+
return $this->status;
38+
}
39+
40+
public function getHeaders() {
41+
return $this->headers;
42+
}
3243
}

0 commit comments

Comments
 (0)