Skip to content

Commit e3fc658

Browse files
committed
fix broad-exception-caught
1 parent 6e72170 commit e3fc658

File tree

1 file changed

+4
-3
lines changed
  • src/azure-cli/azure/cli/command_modules/serviceconnector

1 file changed

+4
-3
lines changed

src/azure-cli/azure/cli/command_modules/serviceconnector/custom.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
ValidationError,
1515
AzureResponseError
1616
)
17+
from azure.core.exceptions import ResourceNotFoundError
1718
from ._resource_config import (
1819
CLIENT_TYPE,
1920
SUPPORTED_AUTH_TYPE,
@@ -545,9 +546,9 @@ def connection_create_func(cmd, client, # pylint: disable=too-many-locals,too-m
545546
logger.warning(
546547
'Connection exists and no property to be updated, skip the update operation.')
547548
return linker
548-
except Exception as e:
549-
logger.debug('No existing connection, start creating a new one. Error: %s', e)
550-
549+
except ResourceNotFoundError as e:
550+
logger.debug('No existing connection, continue to create it.')
551+
551552
if enable_mi_for_db_linker and auth_action != 'optOutAllAuth':
552553
new_auth_info = enable_mi_for_db_linker(
553554
cmd, source_id, target_id, auth_info, client_type, connection_name, connstr_props)

0 commit comments

Comments
 (0)