Skip to content

Commit

Permalink
Add proper apiCLass info to exception
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredup committed Nov 6, 2023
1 parent fb7cdd4 commit 1e1e34b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ApiAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

use Payum\Core\Exception\LogicException;
use Payum\Core\Exception\UnsupportedApiException;
use function get_class;
use function is_object;

trait ApiAwareTrait
{
Expand Down Expand Up @@ -30,7 +32,7 @@ public function setApi($api)
}

if (!$api instanceof $this->apiClass) {
throw new UnsupportedApiException(sprintf('Not supported api given. It must be an instance of %s', $this->apiClass));
throw new UnsupportedApiException(sprintf('Not supported api given. It must be an instance of %s', is_object($this->apiClass) ? get_class($this->apiClass) : $this->apiClass));
}

$this->api = $api;
Expand Down

0 comments on commit 1e1e34b

Please sign in to comment.