Skip to content

Commit 630316d

Browse files
Make error handling for missing databases key more obvious
1 parent 6b4e981 commit 630316d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Auth/Source/SQL2.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public function __construct(array $info, array $config)
6060
parent::__construct($info, $config);
6161

6262
// Check databases configuration that all required parameters are present
63-
if (array_key_exists('databases', $config)) {
63+
if (!array_key_exists('databases', $config)) {
64+
throw new Exception('Missing required attribute \'databases\' for authentication source ' . $this->authId);
65+
} else {
6466
if (!is_array($config['databases'])) {
6567
throw new Exception('Required parameter \'databases\' for authentication source ' .
6668
$this->authId . ' was provided and is expected to be an array. Instead it was: ' .
@@ -108,8 +110,6 @@ public function __construct(array $info, array $config)
108110
'options' => $dbConfig['options'] ?? [],
109111
];
110112
}
111-
} else {
112-
throw new Exception('Missing required attribute \'databases\' for authentication source ' . $this->authId);
113113
}
114114

115115
// Check auth_queries configuration that all required parameters are present

0 commit comments

Comments
 (0)