Skip to content

Commit 4065184

Browse files
authored
Merge pull request #34 from CristalTeam/feature/exception_source
Add exception source & fix debugbar decorator
2 parents ff05dd3 + a5f29b0 commit 4065184

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Bridges/BarryvdhLaravelDebugbar/DebugbarTransportDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,6 @@ public static function formatDuration($seconds)
188188

189189
public function getResponseHeaders(): array
190190
{
191-
$this->transport->getResponseHeaders();
191+
return $this->transport->getResponseHeaders();
192192
}
193193
}

src/Exceptions/ApiException.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ class ApiException extends Exception
99
{
1010
protected $response;
1111

12+
/**
13+
* @var string|null Can be used to specify from which API the exception has been thrown.
14+
*/
15+
protected $source;
16+
1217
public function __construct($response, $message = "", $httpCode = 0, Throwable $previous = null)
1318
{
1419
parent::__construct("The request ended on a $httpCode code : $message", $httpCode, $previous);
@@ -38,4 +43,16 @@ public function getApiErrors()
3843
{
3944
return $this->getResponse('errors');
4045
}
46+
47+
public function getSource(): ?string
48+
{
49+
return $this->source;
50+
}
51+
52+
public function setSource(?string $source): self
53+
{
54+
$this->source = $source;
55+
56+
return $this;
57+
}
4158
}

0 commit comments

Comments
 (0)