diff --git a/.changelog/4631.yml b/.changelog/4631.yml new file mode 100644 index 0000000000..7de6f4e483 --- /dev/null +++ b/.changelog/4631.yml @@ -0,0 +1,4 @@ +changes: +- description: fixed an issue where the SDK failed detecting malformed files. + type: fix +pr_number: 4631 diff --git a/demisto_sdk/commands/common/tools.py b/demisto_sdk/commands/common/tools.py index 970ea10fce..2cb61895a5 100644 --- a/demisto_sdk/commands/common/tools.py +++ b/demisto_sdk/commands/common/tools.py @@ -900,10 +900,10 @@ def get_file( result = json.load(StringIO(file_content)) # It's possible to that the result will be `str` after loading it. In this case, we need to load it again. return json.loads(result) if isinstance(result, str) else result - except Exception as e: - logger.error( - f"{file_path} has a structure issue of file type {type_of_file}\n{e}" - ) + except Exception: + error_message = f"{file_path} is not a valid {type_of_file}" + logger.error("{}", error_message) # noqa: PLE1205 + logger.debug("{}", error_message, exc_info=True) # noqa: PLE1205 if raise_on_error: raise return {}