Skip to content

Commit

Permalink
Add exception API source
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault GRANADA committed Mar 18, 2022
1 parent 612d784 commit a5f29b0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Exceptions/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ class ApiException extends Exception
{
protected $response;

/**
* @var string|null Can be used to specify from which API the exception has been thrown.
*/
protected $source;

public function __construct($response, $message = "", $httpCode = 0, Throwable $previous = null)
{
parent::__construct("The request ended on a $httpCode code : $message", $httpCode, $previous);
Expand Down Expand Up @@ -38,4 +43,16 @@ public function getApiErrors()
{
return $this->getResponse('errors');
}

public function getSource(): ?string
{
return $this->source;
}

public function setSource(?string $source): self
{
$this->source = $source;

return $this;
}
}

0 comments on commit a5f29b0

Please sign in to comment.