Skip to content

Commit 95b7cf2

Browse files
committed
change as per comments
1 parent 1bb9e0b commit 95b7cf2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/spring/azext_spring/_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import requests
1313
import tarfile
1414
import tempfile
15+
import xml.etree.ElementTree as ET
1516
import uuid
1617
from io import open
1718
from re import (search, match, compile)
@@ -334,17 +335,16 @@ def handle_asc_exception(ex):
334335
try:
335336
raise CLIError(ex.inner_exception.error.message)
336337
except AttributeError:
337-
logger.warning(f"CLIError ex: {ex}")
338-
logger.warning(f"CLIError ex.response.internal_response.text: {ex.response.internal_response.text}")
338+
logger.debug(f"CLIError ex: {ex}")
339+
logger.debug(f"CLIError ex.response.internal_response.text: {ex.response.internal_response.text}")
339340
if hasattr(ex, 'response') and ex.response.internal_response.text:
340-
logger.warning("CLIError: Trying to parse the exception message.")
341+
logger.debug("CLIError: Trying to parse the exception message.")
341342
try:
342343
response_dict = json.loads(ex.response.internal_response.text)
343-
logger.warning(f"CLIError response_dict: {response_dict}")
344+
logger.debug(f"CLIError response_dict: {response_dict}")
344345
raise CLIError(response_dict["error"]["message"])
345346
except json.JSONDecodeError:
346347
# Try to extract error from XML format
347-
import xml.etree.ElementTree as ET
348348
try:
349349
root = ET.fromstring(ex.response.internal_response.text)
350350
# Look for common error message patterns in XML
@@ -360,7 +360,7 @@ def handle_asc_exception(ex):
360360
# If both JSON and XML parsing fail, return the raw text
361361
raise CLIError(ex.response.internal_response.text)
362362
else:
363-
logger.warning("CLIError: Unable to parse the exception message.")
363+
logger.debug("CLIError: Unable to parse the exception message.")
364364
raise CLIError(ex)
365365

366366

0 commit comments

Comments
 (0)