Skip to content

Commit 1677120

Browse files
authored
Fix #387: Use appropriate exception if client does not exist
1 parent 18203c0 commit 1677120

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Yii Framework 2 authclient extension Change Log
44
2.2.16 under development
55
------------------------
66

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

99

1010
2.2.15 December 16, 2023

src/Collection.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace yii\authclient;
99

1010
use yii\base\Component;
11-
use yii\base\InvalidParamException;
11+
use yii\base\InvalidArgumentException;
1212
use Yii;
1313

1414
/**
@@ -81,12 +81,12 @@ public function getClients()
8181
/**
8282
* @param string $id service id.
8383
* @return ClientInterface auth client instance.
84-
* @throws InvalidParamException on non existing client request.
84+
* @throws InvalidArgumentException on non existing client request.
8585
*/
8686
public function getClient($id)
8787
{
8888
if (!array_key_exists($id, $this->_clients)) {
89-
throw new InvalidParamException("Unknown auth client '{$id}'.");
89+
throw new InvalidArgumentException("Unknown auth client '{$id}'.");
9090
}
9191
if (!is_object($this->_clients[$id])) {
9292
$this->_clients[$id] = $this->createClient($id, $this->_clients[$id]);

0 commit comments

Comments
 (0)