From b48a198e0cc31f831a109dca16851817c285e3ba Mon Sep 17 00:00:00 2001 From: Maximiliano Osorio Date: Tue, 13 Aug 2019 23:26:48 -0400 Subject: [PATCH] Fix: data corruption exception --- src/wcm/_list.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/wcm/_list.py b/src/wcm/_list.py index c4ac073..609abc8 100644 --- a/src/wcm/_list.py +++ b/src/wcm/_list.py @@ -27,28 +27,31 @@ def list_components(profile="default"): component = wings_instance.component.get_all_items() component = component["children"] for i in component: - comp_class = ((i["cls"])["component"])["id"] - comp_class = comp_class.split('#') + try: + comp_class = ((i["cls"])["component"])["id"] + comp_class = comp_class.split('#') - outp += "[" + comp_class[-1] + "]\n" + outp += "[" + comp_class[-1] + "]\n" - length = len(i["children"]) - count = 1 + length = len(i["children"]) + count = 1 - if length > 0: - outp += " └─┐\n" + if length > 0: + outp += " └─┐\n" - for j in i["children"]: - comp_id = ((j["cls"])["component"])["id"] - comp_id = comp_id.split('#') + for j in i["children"]: + comp_id = ((j["cls"])["component"])["id"] + comp_id = comp_id.split('#') - if length == 1 or count == length: - outp += " └─ " + comp_id[-1] + "\n" - else: - outp += " ├─ " + comp_id[-1] + "\n" - count += 1 + if length == 1 or count == length: + outp += " └─ " + comp_id[-1] + "\n" + else: + outp += " ├─ " + comp_id[-1] + "\n" + count += 1 - outp += "\n" + outp += "\n" + except: + logger.error("Wings error: Maybe, the component is corrupted.") click.echo(outp)