Skip to content

Commit

Permalink
Fix #387: Use appropriate exception if client does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
eluhr committed Mar 19, 2024
1 parent 18203c0 commit 1677120
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Yii Framework 2 authclient extension Change Log
2.2.16 under development
------------------------

- no changes in this release.
- Enh #387: Use appropriate exception if client does not exist (eluhr)


2.2.15 December 16, 2023
Expand Down
6 changes: 3 additions & 3 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace yii\authclient;

use yii\base\Component;
use yii\base\InvalidParamException;
use yii\base\InvalidArgumentException;
use Yii;

/**
Expand Down Expand Up @@ -81,12 +81,12 @@ public function getClients()
/**
* @param string $id service id.
* @return ClientInterface auth client instance.
* @throws InvalidParamException on non existing client request.
* @throws InvalidArgumentException on non existing client request.
*/
public function getClient($id)
{
if (!array_key_exists($id, $this->_clients)) {
throw new InvalidParamException("Unknown auth client '{$id}'.");
throw new InvalidArgumentException("Unknown auth client '{$id}'.");
}
if (!is_object($this->_clients[$id])) {
$this->_clients[$id] = $this->createClient($id, $this->_clients[$id]);
Expand Down

0 comments on commit 1677120

Please sign in to comment.