Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions pyQuARC/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,25 @@ def _error_message(messages):

@staticmethod
def _format_cmr_error(cmr_validation):
if not cmr_validation.get("errors"):
cmr_errors = cmr_validation.get("errors")
if not cmr_errors:
return None
error_msg_dict = {}
error_msg = ""
if errors := cmr_validation.get("errors"):
for error in errors:
if type(error) is dict and error.get("path"):
if error["path"][0] not in error_msg_dict:
error_msg_dict[error["path"][0]] = []
error_msg_dict[error["path"][0]].append(error['errors'])
else:
error_msg_dict["Misc"] = [error]
for error in cmr_errors:
if type(error) is dict and error.get("path"):
if error["path"][0] not in error_msg_dict:
error_msg_dict[error["path"][0]] = []
error_msg_dict[error["path"][0]].append(error['errors'])
else:
error_msg_dict["Misc"] = [error]
for path, errors in error_msg_dict.items():
error_msg += f"\n\t>> {path}: {END}\n"
for error in errors:
error_msg += f"\t\t{COLOR['error']}Error:{END} {str(error)}\n"
error_str = str(error)
if isinstance(error, list):
error_str = ", ".join(error)
error_msg += f"\t\t{COLOR['error']}Error:{END} {error_str}\n"
return error_msg

def display_results(self):
Expand Down