Skip to content

Commit 659bf36

Browse files
committed
add logging and exception
1 parent 46237b4 commit 659bf36

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\FunctionalTestingFramework\DataGenerator\Handlers;
88

9+
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
910
use Magento\FunctionalTestingFramework\Console\BuildProjectCommand;
1011
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
1112
use Magento\FunctionalTestingFramework\Util\Logger\LoggingUtil;
@@ -53,15 +54,23 @@ private function __construct()
5354
*
5455
* @param string $key
5556
* @return string|null
57+
* @throws TestFrameworkException
5658
*/
5759
public function getSecret($key)
5860
{
5961
if (!array_key_exists($key, $this->credentials)) {
60-
LoggingUtil::getInstance()->getLogger(CredentialStore::class)->error(
62+
throw new TestFrameworkException(
6163
"{$key} not defined in .credentials, please provide a value in order to use this secret in a test."
6264
);
6365
}
6466

67+
// log here for verbose config
68+
if (MftfApplicationConfig::getConfig()->verboseEnabled()) {
69+
LoggingUtil::getInstance()->getLogger(CredentialStore::class)->debug(
70+
"retrieving secret for key name {$key}"
71+
);
72+
}
73+
6574
return $this->credentials[$key] ?? null;
6675
}
6776

0 commit comments

Comments
 (0)