Skip to content

Commit 0816ce3

Browse files
Error handling
1 parent 06f2e3c commit 0816ce3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/azure-cli/azure/cli/command_modules/appconfig/_kv_import_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ def __read_kv_from_kubernetes_configmap(
807807

808808
return key_values
809809
except Exception as exception:
810-
raise CLIError(
810+
raise AzureInternalError(
811811
f"Failed to read key-values from ConfigMap '{configmap_name}' in namespace '{namespace}'.\n{str(exception)}"
812812
)
813813

src/azure-cli/azure/cli/command_modules/appconfig/_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def validate_aks_cluster_name_or_id(cmd, namespace):
160160
elif namespace.connection_string:
161161
config_store_name = get_store_name_from_connection_string(namespace.connection_string)
162162
else:
163-
raise CLIError("Please provide App Configuration name or connection string for fetching the AKS cluster details. Alternatively, you can provide a valid ARM ID for the AKS cluster.")
163+
raise ArgumentUsageError("Please provide App Configuration name or connection string for fetching the AKS cluster details. Alternatively, you can provide a valid ARM ID for the AKS cluster.")
164164

165165
resource_group, _ = resolve_store_metadata(cmd, config_store_name)
166166
namespace.aks_cluster = {

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/test_appconfig_kv_import_export_commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from azure.cli.testsdk import (ResourceGroupPreparer, ScenarioTest, LiveScenarioTest)
1515
from azure.cli.command_modules.appconfig._constants import FeatureFlagConstants, KeyVaultConstants, ImportExportProfiles, AppServiceConstants
1616
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
17-
from azure.cli.core.azclierror import MutuallyExclusiveArgumentError
17+
from azure.cli.core.azclierror import AzureInternalError, MutuallyExclusiveArgumentError
1818
from azure.cli.command_modules.appconfig.tests.latest._test_utils import create_config_store, CredentialResponseSanitizer, get_resource_name_prefix
1919

2020
TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
@@ -1329,5 +1329,5 @@ def test_appconfig_import_from_kubernetes_configmap(self, resource_group, locati
13291329
})
13301330

13311331
# This should fail gracefully
1332-
with self.assertRaises(CLIError):
1332+
with self.assertRaises(AzureInternalError):
13331333
self.cmd('appconfig kv import -n {config_store_name} -s aks --aks-cluster {aks_cluster_name} --configmap-name {non_existent_configmap} --configmap-namespace {namespace} --label {error_label} -y')

0 commit comments

Comments
 (0)