Skip to content

Commit 5f2b9a0

Browse files
Manjusha.SManjusha.S
authored andcommitted
added exception
1 parent e85e6d5 commit 5f2b9a0

File tree

1 file changed

+8
-3
lines changed
  • src/Magento/FunctionalTestingFramework/DataTransport/Auth

1 file changed

+8
-3
lines changed

src/Magento/FunctionalTestingFramework/DataTransport/Auth/WebApiAuth.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ class WebApiAuth
5858
public static function getAdminToken($username = null, $password = null)
5959
{
6060
$login = $username ?? getenv('MAGENTO_ADMIN_USERNAME');
61-
$encryptedSecret = CredentialStore::getInstance()->getSecret('magento/MAGENTO_ADMIN_PASSWORD');
62-
$secret = CredentialStore::getInstance()->decryptSecretValue($encryptedSecret);
63-
$password = $password ?? $secret;
61+
try {
62+
$encryptedSecret = CredentialStore::getInstance()->getSecret('magento/MAGENTO_ADMIN_PASSWORD');
63+
$secret = CredentialStore::getInstance()->decryptSecretValue($encryptedSecret);
64+
$password = $password ?? $secret;
65+
} catch (TestFrameworkException $e) {
66+
$message = "Password not found in credentials file";
67+
throw new FastFailException($message . $e->getMessage(), $e->getContext());
68+
}
6469
if (!$login || !$password) {
6570
$message = 'Cannot retrieve API token without credentials. Please fill out .env.';
6671
$context = [

0 commit comments

Comments
 (0)