Skip to content

Commit 7c1db1b

Browse files
handle the exception with list addition
1 parent b3c7fb2 commit 7c1db1b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

shuffle-tools/1.2.0/src/app.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ def merge_lists(self, list_one, list_two, set_field="", sort_key_list_one="", so
15891589
if isinstance(list_one, dict) and isinstance(list_two, dict):
15901590
for key, value in list_two.items():
15911591
list_one[key] = value
1592-
1592+
15931593
return list_one
15941594

15951595
return {"success": False, "message": "Both input lists need to be valid JSON lists."}
@@ -1626,11 +1626,15 @@ def merge_lists(self, list_one, list_two, set_field="", sort_key_list_one="", so
16261626
set_field = set_field.replace(" ", "_", -1)
16271627
list_one[i][set_field] = list_two[i]
16281628
except Exception as e:
1629-
return {
1630-
"success": False,
1631-
"reason": "An error occurred while merging the lists. PS: List one can NOT be a list of integers. If this persists, contact us at [email protected]",
1632-
"exception": f"{e}",
1633-
}
1629+
try:
1630+
# if nothing works lets try to add both list
1631+
list_one = list_one + list_two
1632+
except Exception as e:
1633+
return {
1634+
"success": False,
1635+
"reason": "An error occurred while merging the lists. If this persists, contact us at [email protected]",
1636+
"exception": f"{e}",
1637+
}
16341638

16351639
return list_one
16361640

0 commit comments

Comments
 (0)