Skip to content

Commit

Permalink
ApiResult add exception property
Browse files Browse the repository at this point in the history
  • Loading branch information
z985342160 committed Aug 18, 2024
1 parent f2e10a3 commit d8c8645
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ApiResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Throwable;

class ApiResult
{
Expand All @@ -19,6 +20,8 @@ class ApiResult

private string $message = '';

private ?Throwable $exception = null;

/**
* @return bool
*/
Expand Down Expand Up @@ -113,4 +116,23 @@ public function setData(array $data): static

return $this;
}

/**
* @return array|null
*/
public function getException(): ?Throwable
{
return $this->exception;
}

/**
* @param Throwable $exception
* @return $this
*/
public function setException(Throwable $exception): static
{
$this->exception = $exception;

return $this;
}
}

0 comments on commit d8c8645

Please sign in to comment.